Palindrome Number (Leetcode 9)
Problem Link: https://leetcode.com/problems/palindrome-number/
class Solution:
def isPalindrome(self, x: int) -> bool:
if(x<0):
return False
rev=0
n=x
while(n):
rev=(rev*10)+n%10
n=n//10
if(rev==x):
return True
else:
return False
Last updated