From 392c8b6b7ff5da8e4031383b0f835d3683d4f252 Mon Sep 17 00:00:00 2001 From: apurv69 <72222883+apurv69@users.noreply.github.com> Date: Sat, 3 Oct 2020 11:58:39 +0530 Subject: [PATCH 1/2] Create Backtracking --- Backtracking/Nqueen.cpp | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Backtracking/Nqueen.cpp diff --git a/Backtracking/Nqueen.cpp b/Backtracking/Nqueen.cpp new file mode 100644 index 0000000..0287a01 --- /dev/null +++ b/Backtracking/Nqueen.cpp @@ -0,0 +1,68 @@ +// NQueen +#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< Date: Sat, 3 Oct 2020 12:02:19 +0530 Subject: [PATCH 2/2] Update Nqueen.cpp --- Backtracking/Nqueen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Backtracking/Nqueen.cpp b/Backtracking/Nqueen.cpp index 0287a01..026c612 100644 --- a/Backtracking/Nqueen.cpp +++ b/Backtracking/Nqueen.cpp @@ -1,4 +1,4 @@ -// NQueen +//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;