i have a problem with sudoku.I have to check if is valid or not.I'm stuck at the check line and row, i don't know how to do it.
Here is my code.
static int[] ReadValues()
{
string[] line = Console.ReadLine().Split(' ');
int[] array = Array.ConvertAll(line, int.Parse);
return array;
}
static int[,] CreateMatrix()
{
const int matrixSize = 9;
int[,] sudoku= new int[matrixSize, matrixSize];
for (int i = 0; i < matrixSize; i++)
{
int[] array = ReadValues();
for (int j = 0; j < matrixSize; j++)
{
sudoku[i, j] = array[j];
}
}
return sudoku;
}
static bool CheckLine(int[,] sudoku)
{
// this is the method where I'm stuck
}
static bool CheckRow(int[,] sudoku)
{
// this is the method where I'm stuck
}