Arrays & HashingMedium
Valid Sudoku
A partly filled 9×9 Sudoku is given as 9 strings of 9 characters, digits 1–9 or . for empty. Return true if no digit repeats in any row, column or 3×3 box. (It doesn't have to be solvable.)
Example 1rows = ["8..1.....", ".3...6...", "..7..9.2.", ".5...7...", "....457..", ".......3.", "..1....68", "..85...1.", ".9....4.."] → true
Example 2rows = ["8..1.....", ".3...6...", "..7..9.2.", ".5...7...", "....457..", ".......3.", "..1....68", "..85...1.", ".9....4.8"] → falseThe last column has two 8s.
9 strings of 9 characters · digits 1–9 or .