I have a Sudoku puzzle and I need to make sure that each row and column have each number 1 through 9. What is the easiest way of doing this? The code snippet that I have so far is below.
public static boolean rowsAreValid(int[][] array){
for(int i = 0; i < array.length; i++){
for (int j=0;j<array.length;j++){
This is my Sudoku puzzle. Note that I also need to do the same for each 3x3 section. Your help is greatly appreciated!
3 8 4 2 1 6 9 7 5
9 7 1 8 5 4 3 2 6
5 2 6 7 9 3 4 8 1
2 5 9 6 3 7 8 1 4
1 3 8 4 2 9 6 5 7
6 4 7 5 8 1 2 3 9
8 1 3 9 4 5 7 6 2
7 9 5 3 6 2 1 4 8
4 6 2 1 7 8 5 9 3