A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L5
Problem
Given a list of non-negative integers representing wall heights, find two walls (by index) that together with the x-axis form a container holding the maximum amount of water. Water volume between walls at i and j is min(heights[i], heights[j]) * (j - i). Return that maximum volume.
Summary
Two walls, one sky, and a very important question.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.