1 2 3 4 5 6 7 8 9 10 11 12 13 14# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def isPalindrome(self, head: ListNode) -> bool: a = [] while head: a.append(head.val) head = head.next return True if a == a[::-1] else False