Python O(1) Space O(n^2) Time Solution

  • 0
    class Solution(object):
        def isPalindrome(self, head):
            :type head: ListNode
            :rtype: bool
            if not head or not
                return True
            first = head
            while first:
                second = head
                    second =
                if first.val !=
                    return False
                first =
            return True

Log in to reply

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