Class Solution
java.lang.Object
g2701_2800.s2729_check_if_the_number_is_fascinating.Solution
2729 - Check if The Number is Fascinating.<p>Easy</p>
<p>You are given an integer <code>n</code> that consists of exactly <code>3</code> digits.</p>
<p>We call the number <code>n</code> <strong>fascinating</strong> if, after the following modification, the resulting number contains all the digits from <code>1</code> to <code>9</code> <strong>exactly</strong> once and does not contain any <code>0</code>’s:</p>
<ul>
<li><strong>Concatenate</strong> <code>n</code> with the numbers <code>2 * n</code> and <code>3 * n</code>.</li>
</ul>
<p>Return <code>true</code> <em>if</em> <code>n</code> <em>is fascinating, or</em> <code>false</code> <em>otherwise</em>.</p>
<p><strong>Concatenating</strong> two numbers means joining them together. For example, the concatenation of <code>121</code> and <code>371</code> is <code>121371</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> n = 192</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> 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.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> n = 100</p>
<p><strong>Output:</strong> false</p>
<p><strong>Explanation:</strong> 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.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>100 <= n <= 999</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
isFascinating
public boolean isFascinating(int n)
-