Why is reversed not working?


#1

class Solution: # @param A : integer # @return an integer def isPalindrome(self, A): if A<0: return 0 return int(str(A) == reversed(str(A)))
is not giving the correct solution why?


#3

try not to use in-built function


#4

Because reversed function doesn’t return a string. You can use ‘’.join(reversed(str(x)) to get a reversed string.