Compute two arrays: = length of LIS ending at index (standard LIS) = length of longest decreasing subsequence starting at index To get , run LIS from right to left.
The longest bitonic subsequence using as peak has length (subtract 1 because is counted twice). The answer is for all . Understanding this concept will help you solve more complex problems.