You are given a singly linked list. Check if it reads the same from the front and from the back.
Return true if it does. Otherwise return false.
The answer here is just true or false.
How the judge passes the data
Examples
Example 1:
Input: head = [3,5,5,3]
Output: true
Explanation: The list reads 3 5 5 3 in both directions.
Example 2:
Input: head = [1,2,3,2,1]
Output: true
Explanation: The middle node is 3, and both sides match.
Example 3:
Input: head = [1,2,3,4]
Output: false
Explanation: The front is 1 but the back is 4, so it is not a palindrome.