input: Write a function to check if a given linked list is a palindrome.
  assert checkPalindrome(head) == True
  assert checkPalindrome(Node(1)) == True
  assert checkPalindrome(Node(1, Node(2, Node(2, Node(1))))) == True
  assert checkPalindrome(Node(1, Node(2, Node(3, Node(4))))) == False
output: class Node:
      def __init__(self, val=0, next=None):
          self.val = val
          self.next = next
  
  def checkPalindrome(head):
      # Step 1: Find the middle of the linked list
      slow = fast = head
      while fast and fast.next:
          slow = slow.next
          fast = fast.next.next
  
      # Step 2: Reverse the second half of the linked list
      prev = None
      while slow:
          temp = slow.next
          slow.next = prev
          prev = slow
          slow = temp
  
      # Step 3: Compare the first half and the reversed second half
      left, right = head, prev
      while right:
          if left.val != right.val:
              return False
          left = left.next
          right = right.next
  
      return True