Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.
Problem
Submissions
8-Queen Problem
Contributed by
Prashant Thakur
Easy
0/40
Success Rate 80 %
Share
0 upvotes
Problem Statement
You must find distinct solutions to the 8-queen puzzle. The 8-queen puzzle involves placing 8 queens on a chess board of size (8 X 8) such that no two queens can attack each other. Each solution contains distinct board configurations of the 8-queens’ placement where the solution are a permutation of [1, 2, 3, …., n], here the number in the ith index denotes that the ith column queen is placed in the row with that number.
For example, the permutation [1, 7, 3, 7, 5, 6, 7, 8] means the queen in the 1st column is placed in the 1st row, the queen in the 2nd column is placed in the 7th row, and so on. This permutation may or may not be a valid chessboard configuration for the 8-queen puzzle.
Note: In the output, you will have 1/0 corresponding to whether your answer is right/wrong, where 1 denotes right, and 0 denotes wrong. Also, your program will run only on one input file.
Detailed explanation ( Input/output format, Notes, Images )
Input Format
There is no input.
Output format:
Return a list of all possible chessboard configurations of the 8-queens puzzle.
Note:-
You don't need to print anything. Just implement the given function.