357. Count Numbers with Unique Digits Medium
1/**
2 * [357] Count Numbers with Unique Digits
3 *
4 * Given an integer n, return the count of all numbers with unique digits, x, where 0 <= x < 10^n.
5 *
6 * Example 1:
7 *
8 * Input: n = 2
9 * Output: 91
10 * Explanation: The answer should be the total numbers in the range of 0 ≤ x < 100, excluding 11,22,33,44,55,66,77,88,99
11 *
12 * Example 2:
13 *
14 * Input: n = 0
15 * Output: 1
16 *
17 *
18 * Constraints:
19 *
20 * 0 <= n <= 8
21 *
22 */
23pub struct Solution {}
24
25// problem: https://leetcode.com/problems/count-numbers-with-unique-digits/
26// discuss: https://leetcode.com/problems/count-numbers-with-unique-digits/discuss/?currentPage=1&orderBy=most_votes&query=
27
28// submission codes start here
29
30impl Solution {
31 pub fn count_numbers_with_unique_digits(n: i32) -> i32 {
32 0
33 }
34}
35
36// submission codes end
37
38#[cfg(test)]
39mod tests {
40 use super::*;
41
42 #[test]
43 fn test_357() {
44 }
45}
46
Back
© 2025 bowen.ge All Rights Reserved.