Medium Accuracy: 42.04% Submissions: 8624 Points: 4
Given a linked list, the task is to complete the function maxPalindrome() which returns an integer denoting the length of the longest palindrome list that exist in the given linked list.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size of the linked list . Then in the next line are N space separated values of the given linked list.
For each test case output will be the required max length of the palindrome present in the given linked list.
The task is to complete the function maxPalindrome() which should count the length of longest palindrome in the given list and return it.
1 <= T <= 100
1 <= N <= 100
2 3 7 3 2 12 24
12 4 4 3 14
Testcase 1: 2 -> 3 -> 7 -> 3 -> 2 is the linked list whose nodes leads to a palindrome as 2 3 7 3 2.