Determine if a 9×9 Sudoku board is valid. Only filled cells need to be validated: each row, each column, and each of the nine 3×3 boxes must contain the digits 1–9 without repetition. Empty cells are marked '.'.
board = (classic valid Sudoku board)trueboard = (board with '8' duplicated in column 0)false'1'–'9' or '.'seenseen set)'.'. Compute box = (r/3)*3 + c/3row[r], col[c], or box[box] → return falsetrueThe board is always exactly 9×9 with at most 81 cells, so both time and space are O(1) — bounded by a constant. Three families of sets (rows, columns, boxes) guarantee that each constraint unit is checked independently. The single-pass scan never backtracks: the moment a duplicate is found in any unit, we immediately return false.