Your question is Linked List Palindrome Check. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
A Wisconsin.gov service workflow stores an ordered sequence of processing codes in a singly linked list. Write a function that determines whether the sequence reads identically from the beginning and the end.
Use constant auxiliary space by finding the midpoint with slow and fast pointers, reversing the second half in place, and comparing both halves. The input list may be modified during processing.
The function receives head, either None or a reference to the first ListNode. Each node has an integer value field and a next field that references the next node or None. Return True if the linked-list values form a palindrome; otherwise, return False.
For even-length lists, split the list into two equal halves. For odd-length lists, ignore the middle node when comparing the two sides.
def is_palindrome(head):