# 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: Optional[ListNode]) -> bool:
list = []
while head:
list.append(head.val)
head = head.next
if len(list) == 1:
return True
mid = len(list)//2
left = list[0:mid]
right = list[-len(left):][::-1]
if left == right:
return True
return False