I am not able to think any o(n) approch kindly help,

founded one solution at geek for geeks but solution is not understandable to me.

@sagar_aggarwal do arrays banane padhenge left and right
left vala max inc seq from left ka track rakhega and right vala end se max inc sequence ka track. phir bas iterate karke combine karna hai.
the approach in gfg is the only one how you can do this in o(n) so dry run some input using it.
dont forget to hit like and mark resolved if cleared :smiley:

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.