You are given a board representing a sliding puzzle. The grid contains the numbers from 0 denotes the empty space. In one move, you may swap 0 with one of its adjacent cells that shares an edge with it.
The puzzle is considered solved when board becomes [[1,2,3],[4,5,0]]. Return the minimum number of moves required to reach the solved configuration. If it is impossible, return
Constraints:
board.length == 2
board[i].length == 3
board[i][j]
Each value board[i][j] is unique.
You are given a board representing a sliding puzzle. The grid contains the numbers from 0 denotes the empty space. In one move, you may swap 0 with one of its adjacent cells that shares an edge with it.
The puzzle is considered solved when board becomes [[1,2,3],[4,5,0]]. Return the minimum number of moves required to reach the solved configuration. If it is impossible, return
Constraints:
board.length == 2
board[i].length == 3
board[i][j]
Each value board[i][j] is unique.