Opening your workspace…
Workspace/Coding room
Opening your workspace…
At dusk, a gingerbread house’s candy lanterns are going dark. A tiny witch follows the gumdrop path from the front step to the chimney, relighting one lantern each minute. She lights the first at minute 0. A lantern lit at minute t shines during every numbered minute from t through t + glow[i], inclusive. Counting the minute she lights the last lantern, for how many minutes will the whole path be lit?
[2,2,2]Output1All three shine during minute 2. The first is dark at minute 3.
[5,2,5]Output2The last lantern is lit at minute 2. The middle lantern shines through minute 3, so all three shine during minutes 2 and 3.
The first expiration sets the end of the common interval.
function solve(glow) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.