Back to DSA sheet

Container With Most Water

MediumTwo Pointers
Open on LeetCodeAmazonGoogleMeta

Given heights of vertical lines, pick two lines that with the x-axis form a container holding the most water. Return that maximum area.

Constraints
  • 2 <= height.length <= 10^5
  • 0 <= height[i] <= 10^4
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250Striver A2Z
container-with-most-water.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.