2376. Count Special Integers Hard
1/**
2 * [2376] Count Special Integers
3 *
4 * We call a positive integer special if all of its digits are distinct.
5 * Given a positive integer n, return the number of special integers that belong to the interval [1, n].
6 *
7 * Example 1:
8 *
9 * Input: n = 20
10 * Output: 19
11 * Explanation: All the integers from 1 to 20, except 11, are special. Thus, there are 19 special integers.
12 *
13 * Example 2:
14 *
15 * Input: n = 5
16 * Output: 5
17 * Explanation: All the integers from 1 to 5 are special.
18 *
19 * Example 3:
20 *
21 * Input: n = 135
22 * Output: 110
23 * Explanation: There are 110 integers from 1 to 135 that are special.
24 * Some of the integers that are not special are: 22, 114, and 131.
25 *
26 * Constraints:
27 *
28 * 1 <= n <= 2 * 10^9
29 *
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/count-special-integers/
34// discuss: https://leetcode.com/problems/count-special-integers/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39 pub fn count_special_numbers(n: i32) -> i32 {
40 0
41 }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn test_2376() {
52 }
53}
54
Back
© 2025 bowen.ge All Rights Reserved.