2729. Check if The Number is Fascinating Easy
1/**
2 * [2729] Check if The Number is Fascinating
3 *
4 * You are given an integer n that consists of exactly 3 digits.
5 * We call the number n fascinating if, after the following modification, the resulting number contains all the digits from 1 to 9 exactly once and does not contain any 0's:
6 *
7 * Concatenate n with the numbers 2 * n and 3 * n.
8 *
9 * Return true if n is fascinating, or false otherwise.
10 * Concatenating two numbers means joining them together. For example, the concatenation of 121 and 371 is 121371.
11 *
12 * <strong class="example">Example 1:
13 *
14 * Input: n = 192
15 * Output: true
16 * 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.
17 *
18 * <strong class="example">Example 2:
19 *
20 * Input: n = 100
21 * Output: false
22 * 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.
23 *
24 *
25 * Constraints:
26 *
27 * 100 <= n <= 999
28 *
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/check-if-the-number-is-fascinating/
33// discuss: https://leetcode.com/problems/check-if-the-number-is-fascinating/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38 pub fn is_fascinating(n: i32) -> bool {
39 false
40 }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47 use super::*;
48
49 #[test]
50 fn test_2729() {
51 }
52}
53
Back
© 2025 bowen.ge All Rights Reserved.