# 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
05-01
05-01
05-01
05-01
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交