Question: Please provide me a Java or C++ solution with satisfying the conditions . N and M will be at least two and no more than


Please provide me a Java or C++ solution with satisfying the conditions . N and M will be at least two and no more than 5
2. Silaing BIOCKS A Sliding Block Puzzle is a type of puzzle in which a an N by M rectangular grid contains a single blank space and (NM)-1 numbered tiles. The goal of the puzzle is to arrange the puzzle such that the numbers are ordered left-to- right, top-to-bottom, with the empty space in the top left. This is achieved by repeatedly sliding adjacent tiles into the empty space and thus rearranging the puzzle. You will implement a function that will take a puzzle (represented as a 2d array of integers, with O representing the blank space) and return the minimum number of moves to bring it to a solution. If the puzzle has no solution, you should return -1. A solved An example move: puzzle: 163 163 872 -> 802 4 0 5 4 75 012 345 6 7 8 You may make the following assumptions: * All input will be well-formed: Puzzles will be rectangular, and will contain each number from 0 to (M'N) exactly once No inputs will be null, empty, or zero-length N and M will be at least two and no more than 5 An engineer will review the code that you submit. Please include comments explaining your approach and thought processes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
