def is_valid_sudoku(board):
    """
    Checks if an input sudoku board is valid

    Algorithm:
    For all non-empty squares on board, if value at that square is a number,
    check if the that value exists in that square's row, column, 
    and minor square.

    If it is, return False.
    """
    
    cols = [set() for _ in range(9)]
    squares = [[set() for _ in range(3)] for x in range(3)]
    
    for row in range(9):
        rows = set()
        for col in range(9):
            if board[row][col] == ".":
                continue
            # Check row
            if board[row][col] in rows:
                return False
            else:
                rows.add(board[row][col])

            # Check col
            if board[row][col] in cols[col]:
                return False
            else:
                cols[col].add(board[row][col])

            # Check square 
            if board[row][col] in squares[row // 3][col // 3]:
                return False
            else:
                squares[row // 3][col // 3].add(board[row][col])
    
    return True