Intution behind the approach

I am understanding what the method is saying, but what is the reasoning behind this.

hello @great
consider an index i .

if u know longest increasing sequence thats ends at i and longest decreasing sequence that starts from i then finding bitonnic sequence with i as pivot will be easy right?

it l1 is length of longest increasing sequence ending at i.
if l2 is length of longest decreasing sequence starting from i
then bitonnic length with pivot i will be l1 + l2 -1 (-1 becuase we have consider i in both the sequence )

now if we repeat this process for all values of i { 0 … n-1 } and pick maximum of all it will be our answer right?