terminal
Elevo
/
ESC
Login
Initiate Registration
code
Topics
corporate_fare
Companies
history
History
arrow_back
Back to Challenges
#42
Trapping Rain Water
Hard
Acceptance 0%
Editorial
description
Problem Description
Given `n` non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
checklist
Constraints
n == height.length
1 <= n <= 2 * 10^4
0 <= height[i] <= 10^5
science
Examples
Case #1
In:
height = [0,1,0,2,1,0,1,3,2,1,2,1]
Out:
6
Case #2
In:
height = [4,2,0,3,2,5]
Out:
9
Mastery Tags
Arrays
Dynamic Programming
Stack
Two Pointers
Hiring Companies
Amazon
Goldman Sachs
Google
code
Integrated IDE
Python 3
expand_more
C
C++ 17
Java
JavaScript
Python 3
C
C++ 17
Java
JavaScript
Python 3
refresh
class Solution: def trap(self, height: list[int]) -> int: pass
Login to Compile
Processing
terminal
Debug Output
home
Home
extension
Practice
robot_2
login
Sign In
account_circle
Menu
code_blocks
Coding
psychology
Aptitude
Navigation
close
Login
Registration