Leetcode 728 Solution
This article provides solution to leetcode question 728 (self-dividing-numbers)
Access this page by simply typing in "lcs 728" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/self-dividing-numbers
Solution
class Solution:
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
ans = []
for i in range(left, right + 1):
j = i
while j:
d = j % 10
if d == 0:
break
if i % d != 0:
break
j //= 10
if j == 0:
ans.append(i)
return ans