DP needed to solve this problem

Can anyone give some hints on solving this problem without dynamic programming ?

@Sriram-Rajan-10104264111174086 hey Sriram Rajan there is another method exist .
The idea is to check longest bitonic subarray starting at A[i]. From A[i], first we will check for end of ascent and then end of descent.Overlapping of bitonic subarrays is taken into account by recording a nextStart position when it finds two equal values when going down the slope of the current subarray. If length of this subarray is greater than max_len, we will update max_len. We continue this process till end of array is reached.
the dynamic approach take o(n) time and space o(n).but this approach will o(n) time and o(1) space.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Hi Neeraj, will code and let you know.

@Sriram-Rajan-10104264111174086 sure anytime.