【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]

上一篇:【leetcode❤python】 19. Remove Nth Node From End of List


下一篇:jQuery常用属性方法大全 attr(),val()