Maximum length Biotonic Subarray

how to approach for this problem

Hi @Somith
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.

See i m sharing you the code along with all the comments and explanation. Have a look and try to dry run few cases then you will understand how all works :

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.