← Questions

Robot route with charging cells: fewest charges, then battery, then moves

0
UberCodingLast asked Aug 2026

A robot crosses a grid from S to D. Cells are . (open), # (blocked) or C (a charging cell). The battery limits how far the robot can go between charges, and a charging cell refills it.

Find a route that uses the fewest charging stops; among those, compare by battery, then by the number of moves. Explain the state you search over and why your ordering is correct. A related screen asked for the lexicographically smallest of the best routes.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding