Tap here to switch tabs
Problem
Submissions

Problem: Trapping Rain Water

hard
40 min
Try to solve the Trapping Rain Water problem.

Statement

Given a sequence of non-negative integers representing the heights of bars in an elevation map, the goal is to determine the amount of rainwater that can be trapped between the bars after rain.

Constraints:

  • n==n == heights.length

  • 00 \leq heights[i] 105\leq 10^5

  • 1n1031 \leq n \leq 10^3

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths
Tap here to switch tabs
Problem
Submissions

Problem: Trapping Rain Water

hard
40 min
Try to solve the Trapping Rain Water problem.

Statement

Given a sequence of non-negative integers representing the heights of bars in an elevation map, the goal is to determine the amount of rainwater that can be trapped between the bars after rain.

Constraints:

  • n==n == heights.length

  • 00 \leq heights[i] 105\leq 10^5

  • 1n1031 \leq n \leq 10^3

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths