Loading...

The Trapped Pool

A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
hard
Seniority
senior, staff

Problem

Write a function that takes a list of non-negative integers representing an elevation map where each value is the height of a bar of width 1. Compute how much water can be trapped between bars after it rains.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.