Rainwater harvesting problem

i dont understand the two pointer approach to solve this problem. the most optimised algorithm
kindly explain

hello @mkidwai74
check this article -> 2 pointer
they have explained the 2 pointer algorithm using animation video so that might help u .
I recommend u to read all three approaches before approach 4 because approach 4 depends on all those approaches.

if u still face any issue in understanding the alogorithm then feel free to ask

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.