3490. Count Beautiful Numbers Hard

@problem@discussion
#Dynamic Programming



1/**
2 * [3490] Count Beautiful Numbers
3 *
4 * <p data-end="387" data-start="189">You are given two positive integers, <font face="monospace">l</font> and <font face="monospace">r</font>. A positive integer is called <strong data-end="276" data-start="263">beautiful if the product of its digits is divisible by the sum of its digits.
5 * <p data-end="529" data-start="448">Return the count of beautiful numbers between l and r, inclusive.
6 *  
7 * <strong class="example">Example 1:
8 * <div class="example-block">
9 * Input: <span class="example-io">l = 10, r = 20</span>
10 * Output: <span class="example-io">2</span>
11 * Explanation:
12 * The beautiful numbers in the range are 10 and 20.
13 * </div>
14 * <strong class="example">Example 2:
15 * <div class="example-block">
16 * Input: <span class="example-io">l = 1, r = 15</span>
17 * Output: <span class="example-io">10</span>
18 * Explanation:
19 * The beautiful numbers in the range are 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10.
20 * </div>
21 *  
22 * Constraints:
23 * 
24 * 	1 <= l <= r < 10^9
25 * 
26 */
27pub struct Solution {}
28
29// problem: https://leetcode.com/problems/count-beautiful-numbers/
30// discuss: https://leetcode.com/problems/count-beautiful-numbers/discuss/?currentPage=1&orderBy=most_votes&query=
31
32// submission codes start here
33
34impl Solution {
35    pub fn beautiful_numbers(l: i32, r: i32) -> i32 {
36        0
37    }
38}
39
40// submission codes end
41
42#[cfg(test)]
43mod tests {
44    use super::*;
45
46    #[test]
47    fn test_3490() {
48    }
49}
50

Back
© 2026 bowen.ge All Rights Reserved.