BETA

Difficulty Level:

Easy

Total Submissions: 1770 Accuracy:

44.18%

Longest Bitonic subsequence
     

Given an array of positive integers. The task is to print the maximum length of Bitonic subsequence. 
a subsequenceof array is called Bitonic if it is first increasing, then decreasing.

Input:
First line contains T test cases. First line of every test case consists of N , denoting number of elements in an array. Second line of every test consists of elements in array.

Output:
Single line output, print the longest bitonic sequence.

Constraints:
1<=T<=100
1<=N<=100

Example:
Input:

2
5
1 2 5 3 2
8
1 11 2 10 4 5 2 1
Output:
5
6

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.