Question: / * * * First check whether it's a valid move to put the given number at the given position, * and then put the

/**
* First check whether it's a valid move to put the given number at the given position,
* and then put the given number into the board if and only if it's a valid move.
*
* @param row The row you want to fill number
* @param col The column you want to fill number
* @param val The number you want to fill in
* @param board The current Sudoku board
* @param original The boolean array parallel to board, representing whether
* there's a pre-existing number for each position
* @return 0 if either board or original is null
*-1 if the row is out of valid range (0~8)
*-2 if the column is out of valid range (0~8)
*-3 if val is out of valid range (1~9 and Config.EMPTY)
*-4 if the number at the current position (row, col) is pre-existing
*-5 if there's a conflict in the board after filling in val at (row, col)
* Note: remember to call checkConflictForBoard for this
*1 if there's a success filling in the number. If and only if in
* this case, should you actually place the number into the board.
*
* Note: You need to check the conditions exactly in the above order.
*/
public static int fillNumber(int row, int col, int val, int[][] board, boolean[][] original){
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!