答案:
class Solution:
def countEven(self, num: int) -> int:
def judge(num:int) -> bool:
suum = 0
while num != 0:
suum += num % 10
num = num//10
return True if suum % 2 == 0 else False
res = 0
for i in range(num,0,-1):
if judge(i):
res += 1
return res
提交地址:
https://leetcode.cn/problems/count-integers-with-even-digit-sum/