As reported: Millennium Quantitative Developer (Python) round 1 (2025): two DSA problems — Trapping Rain Water and Container With Most Water; working, optimized solutions were given for both.
This is LeetCode 11 — Container With Most Water. Our write-up: /container-with-most-water.
You are given an array height of n non-negative integers: line i goes from (i, 0) to (i, height[i]). Choose two lines that, together with the x-axis, form a container. Return the maximum amount of water a container can hold (you may not tilt it).
Example 1
height = [1,8,6,2,5,4,8,3,7]
Output: 49
Lines 1 and 8: width 7, height min(8, 7) = 7.
Example 2
height = [1,1]
Output: 1
Constraints: 2 ≤ n ≤ 10^5; 0 ≤ height[i] ≤ 10^4.
Code runner format: one JSON value per line: height. Implement maxArea(height).