Coding Challenge

Container With Most Water

Medium
arraytwo-pointers

Choose two lines that hold the most water.

Each array value represents a vertical line height. Choose two lines that form a container holding the maximum area of water.

Examples

Input: height = [1,8,6,2,5,4,8,3,7]

Output: 49

Constraints

  • 2 <= height.length

Preparing your coding workspace...