Question: / * * * Check whether there's no conflict in the board ( in each row, column and square ) * * Note: Don't duplicate

/**
* Check whether there's no conflict in the board (in each row, column and square)
*
* Note: Don't duplicate code. Be sure to use checkConflictForArray method.
* For each row, column and square, first create array of 9 number set.
* Then call checkConflictForArray method.
*
* Checking square is a little tricky, below is a possible algorithm:
* for (each square s from all the 9 squares in the board){
* create a tempArr of size 9
* for (each position [r, c] from all the 9 positions in square s){
* copy s[r][c] into a corresponding position in tempArr
*// you need to figure out a 1-to-1 map between the index in tempArr
*// and the index in square s
*}
* call checkConflictForArray with tempArr
*}
*
* @param board The current board that needs to be checked
* @return true if no conflict; false otherwise, and when board is null
*/
public static boolean checkConflictForBoard(int[][] board){
return false;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question appears to be incomplete It seems to be related to implementing a method to check for c... View full answer

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!