


Let’s say the array ‘A’ = [1, 2, 3, 4, 5], then after merging indexes 2 and 3, the array ‘A’ will look like [1, 5, 4, 5].
First-line contains ‘T’, denoting the number of Test cases.
For each Test case:
The first line contains an integer, ‘N’, denoting the length of the array ‘A’.
The following line contains ‘N’ space-separated positive integers, representing the array’s values.
For each test case, you have to print an integer denoting the minimum number of operations required to turn the given array into a palindrome.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 5
1 <= ‘N’ <= 10^5
1 <= A[i] <= 10^9, for 1 <= i <= ‘N’
Note- Sum of ‘N’ over all test cases does not exceed 10^5.
Time Limit: 1 sec
Algorithm: