所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。
class Solution:
def rotatedDigits(self, N):
"""
:type N: int
:rtype: int
"""
res = 0
for num in range(N+1):
s_num = str(num)
if ('3' not in s_num and '4' not in s_num and '7' not in s_num) and ('2' in s_num or '5' in s_num or '6' in s_num or '9' in s_num):
res += 1
return res
所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。