# breaking it down medium

The Board Game Dash

House rule: you must land EXACTLY on square n to win — overshoot and you bounce back by the extra! 🎲

You start on square 0 with a board of n squares. You get the dice rolls in order. If a roll would pass n, you bounce: landing = n - (overshoot). Print won on roll <k> the moment you land exactly on n, or square <final> if the rolls run out.

Example:

Input: n = 10, rolls = [4, 4, 3, 1] Output: won on roll 4

The rolls take the position to 4, then 8, then a roll of 3 overshoots to 11 and bounces back to 9, then the 4th roll of 1 lands exactly on 10 — a win.

💡 need a hint?

brk-board-game-dash.py🔒 given lines are locked — write your code in between
loading...