Cloze

Two pointersMedium

Container With Most Water

Each number in height is the height of a bar standing one step from the next. Pick two bars so that, with the floor between them, they hold the most water, and return that amount.

Aim for O(n) time, O(1) spaceInspired by a classic interview problem ↗