Medium Accuracy: 49.89% Submissions: 14745 Points: 4
You are given an array A of size N. The array contains integers and is of even length. The elements of the array represent N coin of values V1, V2, ....Vn. You play against an opponent in an alternating way.
In each turn, a player selects either the first or last coin from the row, removes it from the row permanently, and receives the value of the coin.
You need to determine the maximum possible amouint of money you can win if you go first.
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains N denoting the size of the array. The second line contains N elements of the array.
For each testcase, in a new line, print the maximum amout.
1 <= T <= 100
2 <= N <= 100 1 <= Ai <= 106