Loading...
Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Jobs
Blog
Pricing
Toggle theme
Be The Mentor
Sign In
Get Started
Toggle theme
For the best coding experience, use a desktop browser.
Medium
Array
Container With Most Water
Given heights, find two lines that form a container holding the most water.
Examples
Input:
height = [1,8,6,2,5,4,8,3,7]
Output:
49
Sample Test Cases
Case 1 Input:
[1,8,6,2,5,4,8,3,7]
Expected:
49
Case 2 Input:
[1,1]
Expected:
1
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
[1,8,6,2,5,4,8,3,7]
Expected:
49
Case 2 Input:
[1,1]
Expected:
1