Check if Linked List is Palindrome
##### Submissions: 26888   Accuracy: 39.25%   Difficulty: Easy   Marks: 2

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 Input/Output Examples Use 'Expected Output' option **

Contributor: Amit Khandelwal, Harshit Sidhwa
Author: Shubham Joshi 1

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

to report an issue on this page.