Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    Practice problems / Valid sudoku

    Valid sudoku

    Mediumhash setmatrix

    board has 9 rows of 9 characters: a digit 1–9 or . for an empty cell. Return true if the filled digits never repeat within a row, a column or a 3×3 box. (You don't need to check that it's solvable.)

    Example 1

    Input:  board = ["53..7....","6..195...",".98....6.","8...6...3","4..8.3..1","7...2...6",".6....28.","...419..5","....8..79"]
    Output: true

    Example 2

    Input:  board = ["83..7....","6..195...",".98....6.","8...6...3","4..8.3..1","7...2...6",".6....28.","...419..5","....8..79"]
    Output: false

    The first column has two 8s.

    Constraints

    • board.length == 9
    • board[i].length == 9
    • Digits 1–9 or '.'

    Submit checks your solution against 9 tests, including hidden ones.

    /**
     * @param {string[]} board
     * @return {bool}
     */
    function isValidSudoku(board) {
      
    }
    
    Sign in to run
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.