Given a singly linked list of size N of integers. The task is to check if the given linked list is palindrome or not.
First line of input contains number of testcases T. For each testcase, first line of input contains length of linked list N and next line contains N integers as data of linked list.
For each test case output will be 1 if the linked list is a palindrome else 0.
The task is to complete the function isPalindrome() which takes head as reference as the only parameter and returns true or false if linked list is palindrome or not respectively.
1 <= T <= 103
1 <= N <= 50
Example(To be used only for expected output):
1 2 1
1 2 3 4
Testcase 1: 1 2 1, linked list is palindrome.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.