← ALL NOTES
Array

3568. Minimum Moves to Clean the Classroom

The state that actually matters here is a triple: which cell I stand on, which litter I've already grabbed, and how much energy is still in the tank. Every move costs one step, so a breadth-first search over those states hands me the minimum move count directly. The only twist is that stepping onto an R cell refuels me to the maximum, so the same cell-and-collected-set can be worth revisiting when I arrive with more energy.

Loading…