Skip to content

Commit 87cbe36

Browse files
committedSep 14, 2018
add 728.py
1 parent 50110c8 commit 87cbe36

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎py2/728. Self Dividing Numbers.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution(object):
2+
def selfDividingNumbers(self, left, right):
3+
"""
4+
:type left: int
5+
:type right: int
6+
:rtype: List[int]
7+
"""
8+
return filter(self._is_self_dividing_num, xrange(left, right+1))
9+
10+
def _is_self_dividing_num(self, num):
11+
digits = [int(i) for i in str(num)]
12+
if 0 not in digits:
13+
for i in digits:
14+
if num % i:
15+
break
16+
else:
17+
return True
18+
return False
19+

0 commit comments

Comments
 (0)
Please sign in to comment.