Container With Most Water

Medium
ArrayTwo PointersGreedyAmazonGoogle
Given vertical line heights, choose two lines that hold the most water with the x-axis. Print the maximum area. Input format: - First line: n - Second line: n nonnegative integers

Constraints

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

Sample tests

Sample 1

Sample 2

Sign in to submit