# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
cur = head
result = []
while(cur):
result.append(cur.val)
cur = cur.next
if result == result[::-1]:
return True
else:
return False
面试题 02.06. 回文链表
最新推荐文章于 2021-12-13 23:11:32 发布

189

被折叠的 条评论
为什么被折叠?



