3626. Smallest Divisible Digit Product I
My accepted Python solution to LeetCode problem 3626, Smallest Divisible Digit Product I, running in 1ms.
- Difficulty: Easy
- Python
- Runtime 1ms
- Memory 17.2MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 1ms, memory 17.2MB, accepted 2025-12-31.
class Solution:
def smallestNumber(self, n: int, t: int) -> int:
def digit_product(x):
prod = 1
while x > 0:
prod *= x % 10
x //= 10
return prod
while digit_product(n) % t != 0:
n += 1
return n