Container With Most Water
Find two lines that together with the x-axis form a container, such that the container contains the most water.

30:00

Container With Most Water
medium
Topics
Companies

Find two lines that together with the x-axis form a container, such that the container contains the most water.

Example 1:
Input: [1,8,6,2,5,4,8,3,7]
Output: 49
Constraints:
  • n==height.lengthn == \text{height.length}

  • 2n1052 \leq n \leq 10^5

  • 0height[i]1040 \leq \text{height}[i] \leq 10^4

Input
arr =[1,8,6,2,5,4,8,3,7]
Max Area Found

0

Current Area

-

10L8162235445863778R
Variables
VariableValue
l0
r8
maxArea0
DepthFunction Call
Stack empty
0/41