This function solves the N Queen problem using Branch or Bound . It mainly uses solveNQueensUtil ( ) to solve the problem . It returns False if queens cannot be placed , otherwise return True or prints placement of queens in the form of 1 s . Please note that there may be more than one solutions , this function prints one of the feasible solutions .
def solveNQueens ( ) : NEW_LINE INDENT board = [ [ 0 for i in range ( N ) ] for j in range ( N ) ] NEW_LINE DEDENT