Given the head of a singly linked list
head. Return true if the list is a palindrome, otherwise false.Example 1
Input: head = [1,2,2,1]
Output: True
Explanation: The list reads the same left to right and right to left.
Output: True
Explanation: The list reads the same left to right and right to left.
Example 2
Input: head = [1,2]
Output: False
Explanation: Values at symmetric positions do not match.
Output: False
Explanation: Values at symmetric positions do not match.