Back to all patterns

Two Pointers (Greedy)

1 problems • Practice on LeetCode to earn credits

About This Pattern

Master the Two Pointers (Greedy) pattern by practicing these problems organized by difficulty.Focus on the Key Signals - these are the indicators that tell you when to use this pattern.

Medium (1)

Container With Most Water

Find two lines that together with x-axis form a container with most water.

Key Signals:

Start at both endsMove pointer with smaller heightTrack maximum