Check Linked List Palindrome
Easyjavapythonccppjavascript
Determine whether the values in a singly linked list form a palindrome.
Input Format
The first line contains an integer N. The second line contains N space-separated integers.
Output Format
Print 1 if the list is a palindrome, otherwise print 0.
Example 1
Input
5 1 2 3 2 1
Output
1
Explanation: The list reads the same from both directions.
- 1 <= N <= 100000
- -1000000000 <= value <= 1000000000