Skip to content

Practice Count Beautiful Numbers

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3490
LeetCode Problem

Count Beautiful Numbers

Problem Statement

You are given two positive integers, l and r. 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 and r, inclusive.

Source: Count Beautiful Numbers on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
l = 10, r = 20
Output
2

# Example 2

Input
l = 1, r = 15
Output
10

Constraints

1 <= l <= r < 10^9

Related LeetCode Problems

Practice more problems similar to Count Beautiful Numbers.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.