Total Rainwater Trapped Above an Elevation Profile of Unit-Width Bars
Company: Goldman Sachs
Role: Quantitative Researcher
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: Given the heights of adjacent unit-width bars in an elevation profile, compute the total amount of rainwater that stays trapped between them after rain, with water spilling off both open ends. The coding problem tests reasoning about the bars that bound each position and handling up to 100,000 bars efficiently.
Read the full Goldman Sachs Quantitative Researcher interview experience this question came from