Class Solution
-
- All Implemented Interfaces:
public final class Solution2729 - Check if The Number is Fascinating\.
Easy
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.Example 1:
Input: n = 192
Output: true
Explanation: We concatenate the numbers n = 192 and 2 \* n = 384 and 3 \* n = 576. The resulting number is 192384576. This number contains all the digits from 1 to 9 exactly once.
Example 2:
Input: n = 100
Output: false
Explanation: We concatenate the numbers n = 100 and 2 \* n = 200 and 3 \* n = 300. The resulting number is 100200300. This number does not satisfy any of the conditions.
Constraints:
100 <= n <= 999
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final BooleanisFascinating(Integer n)-
-
Method Detail
-
isFascinating
final Boolean isFascinating(Integer n)
-
-
-
-