Finding max histogram area

I think my logic is correct but I’m facing compile-time error i.e time limit exceeded

share code in cb ide

u need to do it in O(N) time since the constraints are large

refer to this


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.