Back to DSA sheet

Trapping Rain Water

HardTwo Pointers
Open on LeetCodeAmazonGoogleMetaMicrosoft

Given an elevation map of bar heights, compute how much rain water it can trap between the bars.

Constraints
  • 1 <= n <= 2 * 10^4
  • 0 <= height[i] <= 10^5
Sheets
Blind 75Grind 75Love Babbar 450NeetCode 150NeetCode 250Striver A2Z
trapping-rain-water.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.