The problem is N-Queens problem. First, let us understand what does it mean by "N-Queens problem" Then I'll explain to you how backtracking is used for solving this problem. See here a chess board is given of 4 cross 4, 16 cells. A standard chessboard will be of 8X8 But for we are using a size of a problem,we have taken 4X4. And 4 queens are given. So,in a game of chess,queen will be there which will have its move like,horizontal that is in a row or a column or diagonally it moves.
So,here it also a same queen. And that queen,we have to place them on this board. So,all 4 queens we have to place.Such that No,two queens are under attack So,when do you say they are under attack If they are in same row or same column or they are in same diagonal So,we have to avoid these and arrange themselves that,they are not under attack. So,is it possible to arrange that? Yes,it is possible.We get some solutions. Is there only one solution? No,for this we will have more than one solution.And we want all those solutions. So,now We want to know,what all their possible arrangements,from there,which will satisfy these conditions..