Sliding puzzle on a 2 by 3 board

0
Remix

A 2 by 3 board holds tiles 1 to 5 and one empty cell. A move slides a tile next to the empty cell into it. Return the fewest moves to reach the solved board, or -1 if it cannot be solved. Encode each board as a string and run a breadth-first search over states.

AirbnbCodingLast asked Apr 2026
No answer yet. Write the first one; the best answer gets endorsed.