53. Palindrome Linked List
MediumLinked lists
Return true if the values of the linked list read the same forwards and backwards. Try O(1) extra space.
A linked list is passed as ListNode objects with val and next. The tests write lists as arrays.
Example 1
Input: head = [1, 2, 2, 1] Output: true
Constraints
1 ≤ nodes ≤ 10⁵