My 3 test cases out of 4 passes but 1 test case is showing wrong answer. Please help

Hello Shubham, you need to take care of every possible case you can’t eliminate by using max a[i+1],a[j] or max of a[i],a[j-1]
Pls check your soln on this testcase :
8
1 1 2 1 1 2 1 1
The ans is 5 but your soln is giving 6.
You just need to consider all the cases.
Pls have a look at this …

Ok, I got it. Thanks

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.