Largest Bitonic Subarray(Contest)
Largest Bitonic Subarray easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Largest Bitonic Subarray easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
You are given an array of positive integers as input. Print the length of the largest subsequence such subsequence in which the values are arranged first in strictly ascending order and then in strictly descending order. Such a subsequence is known as bitonic sub-array. A purely increasing or purely decreasing subsequence will also be considered as a bitonic sequence with the other part empty.
Note: that the elements in bitonic sub-array need not be consecutive in the given array but the order should remain same. Input First line contains N, size of array. Second line contains elements of array separated by space.
Constraints: 1 < = N < = 10^3 1 < = ai < = 10^6 Output Length of Largest Bitonic Sub-Array Example Input: 6 15 20 20 6 4 2
Output: 5
Explanation: Testcase 1: Here, longest Bitonic sub-array is {15, 20, 6, 4, 2} which has length = 5.
link: