← All problems
Trapping Rain Water
Given an elevation map, compute how much water it traps after raining.
Complexity
Time O(n), Space O(1)
Common pitfalls
- Adding negative water (clamp at 0)
- Wrong pointer-move condition
Your solution
Log in to save your code and track progress.