Low orbitPrefix maximaOpened 3 Dec, 00:00
Day 3: Snow Drift
The habitat ring's roofline is a single row of panels of different heights, and a storm of artificial snow has just been switched on for the season. Your input is one line of comma-separated panel heights, left to right. Each panel is one unit wide.
Snow settles flat and fills every dip it can: above each panel, snow rises to the lower of the tallest panel to its left (including itself) and the tallest panel to its right (including itself). Anything above that spills away. For example:
4,1,3,0,2,5,1,2
The snow levels are 4,4,4,4,4,5,2,2, so the panels hold 0+3+1+4+2+0+1+0 = 11 units of snow.
How much snow is trapped on your roofline?
See the example worked
Step 10 of 10- snow
- 0
- snow
- 3
- snow
- 4
- snow
- 8
- snow
- 10
- snow
- 11
- snow
- 11
