Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Container With Most Water

Given n non-negative integers representing vertical lines at positions 1..n, choose two lines that together with the x-axis form a container holding the most water. Print the maximum area.

Constraints

2 <= n <= 10^5 0 <= height[i] <= 10^4

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.