Problem
Given an array of heights representing an elevation map, compute how much water can be trapped after rain.
References
Difficulty
🔴 Hard
Companies
Google, Goldman Sachs, Sumo Logic
Notes
Language: Java
Multiple approaches: O(n) space prefix arrays, or O(1) space two-pointer. Understand both.
Problem
Given an array of heights representing an elevation map, compute how much water can be trapped after rain.
References
Difficulty
🔴 Hard
Companies
Google, Goldman Sachs, Sumo Logic
Notes
Language: Java
Multiple approaches: O(n) space prefix arrays, or O(1) space two-pointer. Understand both.