From 68eeea57d959eca21d49f1abc962922f34471990 Mon Sep 17 00:00:00 2001 From: prarthana1998 <41475054+prarthana1998@users.noreply.github.com> Date: Thu, 1 Oct 2020 22:32:46 +0530 Subject: [PATCH] Added N Queens --- N Queens | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 N Queens diff --git a/N Queens b/N Queens new file mode 100644 index 0000000..e12f124 --- /dev/null +++ b/N Queens @@ -0,0 +1,79 @@ +#include +using namespace std; + +bool isQueenSafe(int chess[][10], int row, int col,int n){ + //checking col + for(int i=0;i=0 && y>=0) + { + if(chess[x][y]==1){ + return false;} + x--; + y--; + } + //right diagonal + x=row; + y=col; + while(x>=0 && y>n; +int chess[10][10]={0}; + printNQueens(chess,0,n); + }