Why ans=max of I + max of D - 1

why we did -1 in final answer ?

Hey @premang
you have increasing sequence ending at a particular number, and decreasing sequence starting from the same particular number, and you add both of them to find the length of bitonic subarray, the particular number gets added twice so you need to subtract 1 to count that particular number only once.

perfect :slight_smile: