2729. Check if The Number is Fascinating
You are given an integer
n
that consists of exactly3
digits.We call the number
n
fascinating if, after the following modification, the resulting number contains all the digits from1
to9
exactly once and does not contain any0
‘s:
- Concatenate
n
with the numbers2 * n
and3 * n
.Return
true
ifn
is fascinating, orfalse
otherwise.Concatenating two numbers means joining them together. For example, the concatenation of
121
and371
is121371
.
1 | class Solution { |