Gamified challenge · Dijkstra
Your rover 🚙 starts at S and must reach base E. Each row of grid is a string: # is a rock, . is flat sand that costs 1 fuel to drive onto, and a digit 2–9 is rough ground that costs that much.
Write route(grid) that returns the rover's moves as a string of U, D, L, R. The route must avoid rocks, stay on the map, end on E, and use the least fuel possible (the start cell is free). Any cheapest route passes.
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