Medium
Container With Most Water
Topic: Two Pointers •
Acceptance: 56%
You are given an integer array `height` of length n. Find two lines that together with the x-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store.
Input Format:
First line: n. Second line: n integers representing heights.
Output Format:
Print the maximum area.
Sample Example:
Sample Input:
9 1 8 6 2 5 4 8 3 7Sample Output:
49
Sandboxed Engine
Ready to test. Click Test All Cases or Submit Solution to evaluate your code.
// Code Playground Cloud Execution Engine v2.4
// Write your code and click 'Run Code' to execute.
$ ready
Standard Input (stdin):
Your code can read standard input via
stdin.