234. Palindrome Linked List
Practice Palindrome Linked List for free on NudgeCode: Easy, Linked List pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Return true if the values of a linked list read the same from front to back as from back to front, otherwise false. Try to do it in O(n) time and O(1) extra space.
Example
head = [1,2,2,1] -> true
head = [1,2] -> false
Constraints
- 1 <= length of the list <= 10^5
- 0 <= Node.val <= 9