Is the list a palindrome?
Write is_palindrome(head) that returns whether the linked list reads the same forwards
and backwards.
is_palindrome(1 -> 2 -> 2 -> 1) -> True
is_palindrome(1 -> 2) -> False
is_palindrome(None) -> True
The point is to practise combining the techniques: find the middle, reverse the second half, compare. Reading the values into a Python list also passes.
def is_palindrome(head):
...