Given a singly linked list A, determine if it's a palindrome. Return 1 or 0, denoting if it's a palindrome or not, respectively.
1 <= |A| <= 105
The first and the only argument of input contains a pointer to the head of the given linked list.
Return 0, if the linked list is not a palindrome.
Return 1, if the linked list is a palindrome.
A = [1, 2, 2, 1]
A = [1, 3, 2]
The first linked list is a palindrome as [1, 2, 2, 1] is equal to its reversed form.
The second linked list is not a palindrom as [1, 3, 2] is not equal to [2, 3, 1].
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.