Maximum length Biotonic Subarray

im not able to build any approach ,plz help me

Hi @akb.tech17
in this question what you can do is make 2 arrays: left and right.
In left array store the length of non-decreasing subarray ending at arr[i]. Create it while traversing on array from left to right.
Similarlry, in right array store the length of non-decreasing subarray ending at arr[i]. This time traverse on array from right to left.
Now find maximum value of (left[i] + right[i] - 1 ). This is your answer.

Hope this helps
Mark resolved if satisfied :slight_smile:

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.