Rain water harvesting

how to approach this problem??

@amishakumari
A Simple Solution is to traverse every array element and find the highest bars on left and right sides for that particular bar. Take the smaller of two heights. The difference between the smaller height and height of the current element is the amount of water that can be stored in this array element.

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.