#-*- 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]
相关文章
- 02-24leetcode:Odd Even Linked List
- 02-24[leetcode] Reverse Linked List 分类: leetcode 算法 2015-07-09 18:44 2人阅读 评论(0) 收藏
- 02-24【LeetCode】109. Convert Sorted List to Binary Search Tree 解题报告(Python)
- 02-24[LeetCode203]Remove Linked List Elements
- 02-24LeetCode解题报告—— Reverse Linked List II & Restore IP Addresses & Unique Binary Search Trees II
- 02-24[LeetCode] 141. Linked List Cycle 单链表判圆算法
- 02-24【Leetcode】141. 环形链表(Linked List Cycle)
- 02-24LeetCode 141. Linked List Cycle--百度面试编程题--C++,Python解法
- 02-24leetcode 206. Reverse Linked List
- 02-24[LeetCode] 426. Convert Binary Search Tree to Sorted Doubly Linked List