ByteByteGo logo
menuProblems List

Largest Container

Medium

You are given an array of numbers, each representing the height of a vertical line on a graph. A container can be formed with any pair of these lines, along with the x-axis of the graph. Return the amount of water which the largest container can hold.

Example:

Example
Input: heights = [2, 7, 8, 3, 7, 6]
Output: 24

You can practice coding exercises online by logging into bytebytego.com on your laptop.