【leetcode❤python】 234. Palindrome Linked List

#-*- coding: UTF-8 -*-
class Solution(object):
    def isPalindrome(self, head):
        """
        :type head: ListNode
        :rtype: bool
        """
        if head==None or head.next==None:return True
        resList=[]
        while head!=None:
            resList.append(head.val)
            head=head.next
    
        return resList==resList[::-1]

posted @ 2016-11-13 19:18  火金队长  阅读(195)  评论(0编辑  收藏  举报