def valid(board):
    '''
    Checks whether a board has no duplicate rows or columns. This is needed to
    filter out invalid solutions from the constraint solver.
    '''
    return ((len(set(map(tuple, board))) == len(board)) and
            (len(set(zip(*board))) == len(board)))

    Checks whether a board has no duplicate rows or columns. This is needed to
    filter out invalid solutions from the constraint solver.
    
recipes/Python/578414_Takuzu_solver/recipe-578414.py