A Fox is looking to collect some coins placed in a line. The fox is very greedy and follows an unusual way of collecting coins. The Fox has decided that it will collect coins in an increasing order only since she always craves for more money and all the coins must be contiguous. It wants to maximize the amount of money it collects. Each coin has its value printed on it.
Unfortunately, the Fox is greedy but not intelligent enough to find the solution and asks you for help. Print the maximum amount of money it will take home. You are given the value of each coin in an array in the order in which the coins are placed.
The first line of input contains an integer T denoting the number of test cases. Each test case contains the number of elements in the array a as n and next line contains space separated n elements in the array.
Print an integer which is the required answer.
2 1 4 7 3 6
38 7 8 10 12
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.