# @return a boolean
def isPalindrome(self, x):
return str(x)[::-1] == str(x)
Is there extra space?
Yep, you're creating a stringified copy of x. The question specifies doing it in constant space to forbid you from doing it this way.
The question states no extra space.
Is it up to interpretation that it means constant space and not O(n) space?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.