public int numChildren(int row){
  int count=0;
  nextValidRowPositions.clear();
  for (int i=0; i < n; i++) {
    board[row][i]=true;
    if (valid(row,i)) {
      count++;
      nextValidRowPositions.add(i);
    }
    board[row][i]=false;
  }
  return count;
}

public int numChildren ( int row ) { int count = 0 ; nextValidRowPositions . clear ( ) ; for ( int i = 0 ; i < n ; i ++ ) { board [ row ] [ i ] = true ; if ( valid ( row , i ) ) { count ++ ; nextValidRowPositions . add ( i ) ; } board [ row ] [ i ] = false ; } return count ; }
find out how many valid children states are found by trying to add a queen to the given row . note : no error checking to ensure you aren ' t adding a queen to a row which already contains one . caveat emptor ! returns a number from 0 to n .
