1
2
3
4
5
6
7
8
9
10
11
12
13
14
| class Solution:
def sumOfNumberAndReverse(self, num: int) -> bool:
def rev(n):
rn = 0
while n:
rn = rn * 10 + n % 10
n //= 10
return rn
for n1 in range(num // 2, num + 1):
if n1 + rev(n1) == num:
return True
return False
|