Problem 2766 · Medium
Keep the occupied positions in a hash set; each move removes its source position and adds its destination.
Open the interactive visualisation