Given an array containing N numbers. The task is to find the maximum sum bitonic subarray. A bitonic subarray is a subarray in which elements are first increasing and then decreasing. A strictly increasing or strictly decreasing subarray is also considered as bitonic subarray.
Time Complexity : O(n)
Auxiliary Space : O(1)
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains a integer N and the second line contains N space separated array elements.
For each test case, print the maximum bitonic subarray sum in new line.
5 3 9 2 7 6 4
5 4 3 2 1 10 6