Longest Bitonic subsequence
Submissions: 7066   Accuracy:

40.38%

  Difficulty: Medium   Marks: 4

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:
For each testcase, in a new line, print the length of longest bitonic sequence.

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

1<=Ai<=200

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
Author: saksham seth


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

to report an issue on this page.