233. Number of Digit One Hard

@problem@discussion
#Math#Dynamic Programming#Recursion



1/**
2 * [233] Number of Digit One
3 *
4 * Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.
5 *  
6 * Example 1:
7 * 
8 * Input: n = 13
9 * Output: 6
10 * 
11 * Example 2:
12 * 
13 * Input: n = 0
14 * Output: 0
15 * 
16 *  
17 * Constraints:
18 * 
19 * 	0 <= n <= 10^9
20 * 
21 */
22pub struct Solution {}
23
24// problem: https://leetcode.com/problems/number-of-digit-one/
25// discuss: https://leetcode.com/problems/number-of-digit-one/discuss/?currentPage=1&orderBy=most_votes&query=
26
27// submission codes start here
28
29impl Solution {
30    pub fn count_digit_one(n: i32) -> i32 {
31        0
32    }
33}
34
35// submission codes end
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40
41    #[test]
42    fn test_233() {
43    }
44}
45


Back
© 2025 bowen.ge All Rights Reserved.