Sliding puzzle solver
Your task
You have a 2x3 sliding puzzle whose tiles are labeled 1..5 with 0 representing the empty slot. A move swaps 0 with an orthogonally adjacent tile. The solved state is [[1,2,3],[4,5,0]]. Given a starting board, return the least number of moves to reach the solved state, or -1 if it is unsolvable. The board is always a 2x3 grid containing exactly the tiles 0..5.
Examples
sliding_puzzle(board: list[list[int]]) -> intExample 1
Input
sliding_puzzle([[1, 2, 3], [4, 0, 5]])Output
1