neetcode/easy/palindrome-number.py

14 lines
296 B
Python

#!/usr/bin/python
# yigid balaban <fyb@fybx.dev>
# neetcode 2024
# easy / palindrome number
def solution(x: int) -> bool:
return str(x) == str(x)[::-1]
print(solution(121) == True)
print(solution(0) == True)
print(solution(-121) == False)
print(solution(10) == False)