|@Rahul Jadhav 1||458|
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
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes