Water above a bar is limited by the tallest bar to its left and right.
Use two pointers and track left_max and right_max.
height[l] < height[r], the right side is tall enough to bound l, so we can finalize water at l using left_max.r using right_max.The smaller side determines the current bounding height; the opposite side is guaranteed to be at least as high as the smaller boundary for that step.
Water above a bar is limited by the tallest bar to its left and right.
Use two pointers and track left_max and right_max.
height[l] < height[r], the right side is tall enough to bound l, so we can finalize water at l using left_max.r using right_max.The smaller side determines the current bounding height; the opposite side is guaranteed to be at least as high as the smaller boundary for that step.