BETA

Submissions : 6917 Accuracy :

31.26

Check if Linked List is Palindrome (Function Program)

Given a singly linked list of integers, Your task is to complete the function isPalindrome that returns true if the given list is palindrome, else returns false.

Input:
The first line of input contains an integer T denoting the no of test cases. Then T testcases follow. Each test case contains 2 line the first line of each test case contains an integer N denoting the size of the linked list. The next line contains N space separated integers denoting the values of the nodes of the linked list.

Output:
For each test case output will be 1 if the linked list is a palindrome else 0.

Constraints:
1<=T<=1000
1<=N<=50

Example(To be used only for expected output):
Input

2
3
1 2 1
4
1 2 3 4

Output:
1
0

**For More Examples Use Expected Output**


Contributor: Amit Khandelwal, Harshit Sidhwa


					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.