Rain Water Harvesting

Why is the best approach tot his question TLE and the better approach is not?

hello @anindya-gupta
we have O(n) approach for this.

image

image