Line 3 within the Solution paragraph of this problem is:
The water trapped by the corresponding lines is (j-i)* min(A[j], A[i]), which can be done in O(n) time.
Is not this computation done in O(1) time for a given index pair (i, j)? I wasn’t sure why it says O(n) unless it’s counting multiplication as a not constant time operation.