diff --git a/Backtracking/Nqueen.cpp b/Backtracking/Nqueen.cpp new file mode 100644 index 0000000..026c612 --- /dev/null +++ b/Backtracking/Nqueen.cpp @@ -0,0 +1,68 @@ +//Problem Statement: You have given a interger N which is the size of NxN chess board and now you need to find all the arrangements in which we can fill N queens on it. +#include +using namespace std; + +bool KyaYahaRakhSkteHai(int board[][100],int i,int j,int n){ + for(int k=0;k=0 && c>=0){ + if(board[r][c]){ + return false; + } + r--; + c--; + } + r=i,c=j; + while(r>=0 && c>n; + NQueen(board,0,n); + + cout<