Container With Most Water

Medium · Arrays & Strings · about 20 minutes

Asked at Amazon, Google, Meta, Bloomberg.

height[i] is how tall a vertical wall standing at position x = i is. Choose any two walls; together with the floor they hold water up to the level of the lower wall, across the distance between them. What is the largest volume any pair can hold?

Related guides