Class Solution
-
- All Implemented Interfaces:
public final class Solution
3490 - Count Beautiful Numbers.
Hard
You are given two positive integers,
l
andr
. A positive integer is called beautiful if the product of its digits is divisible by the sum of its digits.Return the count of beautiful numbers between
l
andr
, inclusive.Example 1:
Input: l = 10, r = 20
Output: 2
Explanation:
The beautiful numbers in the range are 10 and 20.
Example 2:
Input: l = 1, r = 15
Output: 10
Explanation:
The beautiful numbers in the range are 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10.
Constraints:
<code>1 <= l <= r < 10<sup>9</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final Integer
beautifulNumbers(Integer l, Integer r)
-
-
Method Detail
-
beautifulNumbers
final Integer beautifulNumbers(Integer l, Integer r)
-
-
-
-