248 ms python solution : Requesting Code Review


  • -1
    M
    class Solution:
        # @return a boolean
        def isPalindrome(self, x):
            return str(x) == str(x)[::-1]
    

    Here is my solution to the integer palindrome problem . LMK if I can improve this further.


  • 1
    7

    If you are thinking of converting the integer to string, note the
    restriction of using extra space.


  • 0
    M

    Well - thanks for the catch ! I guess this solution doesn't work then ( though the judge accepts it ) I will try to implement this in a different way ! thanks again.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.