Palindrome Linked List
mediumLinked listTwo pointersStack
Given the head of a singly linked list, return true if the values read the same
forwards and backwards.
Example 1:
Input: head = [1, 2, 2, 1]
Output: true
Example 2:
Input: head = [1, 2]
Output: false
Example 3:
Input: head = []
Output: true
Explanation: an empty list reads the same either way.
Constraints:
- the list holds between 0 and 10^5 nodes
0 <= Node.val <= 9