class Solution:
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
# check every digit
return [x for x in range(left, right+1) if all([int(i) != 0 and x % int(i)==0 for i in str(x)])]
# def selfDividingNumbers(self, left: int, right: int) -> List[int]:
# return [x for x in range(left, right+1) if all((i and (x % i==0) for i in map(int, str(x))))]
Download Self Dividing Numbers.pyLeetcode 728 Self Dividing Numbers problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.