@@ -0,0 +1,1381 @@
+# Definition for singly-linked list.%0Aclass ListNode:%0A    def __init__(self, x):%0A        self.val = x%0A        self.next = None%0A%0Aclass Solution:%0A    # @param head, a ListNode%0A    # @return a boolean%0A    def isPalindrome(self, head):%0A        # Write your code here%0A        if head is None:%0A            return True%0A        slow, fast = head, head%0A        while fast.next and fast.next.next:%0A            slow = slow.next%0A            fast = fast.next.next%0A%0A        second = slow.next%0A        p = second%0A        print 'slow ' + str(slow.val)%0A        while p:%0A            print p.val%0A            p = p.next%0A            %0A        dumpy = ListNode(0)%0A        dumpy.next = head%0A%0A        %0A        %0A        while head.next:%0A            if fast.next and head.next == second:%0A                head.next = None%0A                break%0A            if not fast.next and head.next == slow:%0A                head.next = None%0A                break%0A            tmp = head.next%0A            head.next = tmp.next%0A            tmp.next = dumpy.next%0A            dumpy.next = tmp%0A        %0A        first = dumpy.next%0A%0A        p = first%0A        print%0A        while p:%0A            print p.val%0A            p = p.next%0A        %0A        %0A        while first and second:%0A            if first.val != second.val:%0A                return False%0A            first = first.next%0A            second = second.next%0A        return True

Add PalLinkedList