Exemple #1
0
        public bool IsValidSudoku(char[][] board)
        {
            var validator = new SudokuValidator();

            for (int i = 0; i < board.Length; i++)
            {
                for (int j = 0; j < board[i].Length; j++)
                {
                    if (board[i][j] == '.')
                    {
                        continue;
                    }

                    var cellValue = CharToInt(board[i][j]);
                    if (!validator.AddCellValueAndReturnIfValid(cellValue, i, j))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }