Skip to main content
PreparationZone Logo
PreparationZone
Back to Coding

Coding · Medium · Pro

Valid sudoku board (no duplicate in row/col/box)

CodingMatrixSenior
Model answerPreview

Approach

  • Three boolean arrays or sets per row, col, box index.
  • Box index = (r/3)*3 + c/3.

Java Solution

Java
boolean isValidSudoku(char[][] b) {
    boolean[][] row = new boolean[9][9], col = new boolean[9][9…