Gamified challenge · Simulation
Every tile holds an arrow: > right, < left, ^ up, v down. A token starts on tile (row, col) and keeps moving one tile the way its tile points.
Write exitSteps(grid, row, col) (exit_steps in Python) that returns how many moves the token makes until it leaves the grid, or -1 if it goes round in a loop forever. Stepping off the edge counts as a move.
This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.
Sign in with Google