2608. Count the Digits That Divide a Number
My accepted Python solution to LeetCode problem 2608, Count the Digits That Divide a Number, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 12.3MB
- 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 0ms, memory 12.3MB, accepted 2025-12-24.
class Solution(object):
def countDigits(self, num):
count = 0
n = num
while n > 0:
digit = n % 10
if num % digit == 0:
count += 1
n //= 10
return count