Trapping Rain Water
Hard📝 Description
Calculate how much water can be trapped between bars
Input Format
Array of heights
Output Format
Total trapped water
Constraints
n == height.length 1 ≤ n ≤ 2 * 10^4
🔍 Sample Input
[0,1,0,2,1,0,1,3,2,1,2,1]
✅ Sample Output
6
Code Editor
Please login to run and submit code.
Results
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run