Opening your workspace…
Workspace/Coding room
Opening your workspace…
A brewery schedules a quiet tasting shift across consecutive minutes. Each entry of noise is the nonnegative number of noisy machine-seconds during that minute. The shift may spend at most budget noisy seconds in total. Return the inclusive zero-based range [start, end] of the longest nonempty shift within budget. If several shifts have the same longest length, return the one starting earliest. If no minute can be included, return [-1, -1]. A shift cannot skip minutes.
[2,0,3,1,0,2], 4OUTPUT[1,4]Minutes 1 through 4 have total noise 4 and length 4. No length-5 shift fits.
[2,2,2], 4OUTPUT[0,1]Both length-2 shifts fit. The earlier one starts at minute 0.
Tab inserts two spaces. Press Escape, then Tab, to leave the editor. Press Control or Command and Enter to submit.
[2,0,3,1,0,2], 4[1,4]Public samples only. These checks do not award ranked points.
Walk through a solution, check its time and space costs, and compare it with yours.
Checking your progress…