Time complexity for rainwater harvesting

what is the time complexity for precomputed leftmax and rightmax approach and final two pointer approach?

Hey @kani001
In precomputation method
There will be 3 traverses
So time is O(n) and space is also O(n)

In 2 pointer
Only 1 traverse
So time is O(n) ,space is O(1)