Here, I am storing the left smaller element’s index in my left array and storing right smaller element’s index in the right array. Then in function ‘solve’ I am calculating the width of the using left and right vector and multiplying with array elements to get desired area. And also I have taken pseudo index if previous smaller element is not present then ‘-1’ and if next smaller element is not present ‘7’.
Histogram area using stack
Hello @div_yanshu07 please wait i am checking your code.
you can close anyone doubt.
we can use anyone to see 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.