not able to understand best approach provided here.
Rain water trapping editorial
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