Back to problems

Snowy Mountain Path with Melting

Algorithm · Atlassian · Hard

A straight mountain trail has n points, numbered 0 through n - 1. The array base gives the base elevation of each point: base[i] is the elevation of point i before any snow is considered. Over a sequence of days, snow may accumulate and melt at each point. The daily new snowfall is given by the 2D array snow, where snow[d][i] is the amount of snow that falls at point i on day d. Snow accumulation and melting follow these rules: Snowfall is cumulative: if x units of snow fall…

Checking your access…