Palindrome Linked List
Easy
LC #234
fast & slow pointersin-place reversalNot attempted yet
Given the head of a singly linked list, return True if
its values read the same forwards and backwards, otherwise
False.
Example 1
Input: head = [1,2,2,1]
Output: True
Example 2
Input: head = [1,2]
Output: False
Example 3
Input: head = [1,2,1]
Output: True
Constraints
- 0 ≤ number of nodes ≤ 10⁵
- -10⁵ ≤ Node.val ≤ 10⁵
Can you do it in O(n) time and O(1) extra space?