Return True if the list reads the same forwards and backwards. Try to use only O(1) extra memory (copying the values into a Python list is the easy way, but the challenge is to do it with pointers).
The tests show a list as a Python list of its values: [1, 2, 3] stands for 1 -> 2 -> 3.
Example 1
Input:
is_palindrome_list(head) # head = 1 -> 2 -> 2 -> 1
Output:
True
Example 2
Input:
is_palindrome_list(head) # head = 1 -> 2
Output:
False
0 <= number of nodes <= 1000000 <= val <= 9No results yet
Run your code to check it against the examples, or submit to run every test.