2729. Check if The Number is Fascinating
You are given an integer
nthat consists of exactly3digits.We call the number
nfascinating if, after the following modification, the resulting number contains all the digits from1to9exactly once and does not contain any0‘s:
- Concatenate
nwith the numbers2 * nand3 * n.Return
trueifnis fascinating, orfalseotherwise.Concatenating two numbers means joining them together. For example, the concatenation of
121and371is121371.
1 | class Solution { |