CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 03:09:36 GMT
content-type: text/html; charset=utf-8
cf-ray: 9658f05d0aefc462-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=6f912b84-2945-499e-8be9-fa2613209d79; expires=Mon, 27 Jul 2026 03:09:36 GMT; domain=.stackexchange.com; path=/; secure; httponly
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com
x-clacks-overhead: GNU Terry Pratchett
x-frame-options: SAMEORIGIN
x-request-guid: 33c62f54-a7db-4bf1-ab59-14c78661702c
x-worker-origin-response-time: 357000000
x-dns-prefetch-control: off
set-cookie: prov=6f912b84-2945-499e-8be9-fa2613209d79; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=WmKnV7MCM0zwSvEk6UWzRCuwS5jfrMcsgELoOIflyAM-1753585776-1.0.1.1-AJb61VCggFTfsSdJpHxdG5y7030za.sw2h3B4yZu87bROiW.YJmPIpVYuo2t.yPtGBMRcTSFrx8Ob7e_rugs.FEhyeJBdKue84QhiE8XC40; path=/; expires=Sun, 27-Jul-25 03:39:36 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=.kmLjfB.rA6nCXeK6TC8KcnwBSFc1LnOO3bpnDMVY6c-1753585776532-0.0.1.1-604800000; path=/; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
server: cloudflare
content-encoding: gzip
Newest 'n-queens' Questions - Code Review Stack Exchange
Skip to main content
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack ExchangeTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsQuestions tagged [n-queens]
The n-queens puzzle is the problem of placing n chess queens on an n×n chessboard so that no two queens can attack each other.
43 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
2
answers
143
views
Third way to place queens and rooks with the higher score (extension of the queen problem)
Here is a third implementation, the second is in my question Place queens and rooks with the higher score (extension of the queen problem) and an initial one is in my answer for the question N queen ...
4
votes
1
answer
140
views
Place queens and rooks with the higher score (extension of the queen problem)
This is a continuation of the question N queen problem-like (+rooks and a different goal) written by someone else, where I answered.
EDIT I continued to work on the subject and a third implementation ...
6
votes
3
answers
687
views
N queen problem-like (+rooks and a different goal)
The problem is:
You have Q queens and R rooks on a board with sides of length (R+Q) ≤ 8, and you have to place all the pieces so that none attack any other piece. Each square on the board has a score ...
3
votes
1
answer
238
views
Solution to the N Queens Puzzle in the PicoBlaze assembly language
You can see it live here:
...
3
votes
1
answer
90
views
<Programming in Lua - 4th> exercise 2.2 - place 8 queens
About exercise 2.2
Place N queens on N*N board, 1 queen per line, so that all queens are safe.
Use permutation to improve the provided implementation from book.
The ...
2
votes
1
answer
74
views
Solving the N Queens Puzzle in AEC using stack
N Queens Puzzle is a puzzle which asks you to place N chess queens on an NxN chess board so that no two queens are attacking each other. Two queens are attacking each other if they are on the same row,...
1
vote
2
answers
372
views
Count the number of ways N queens can be placed on an N✕N chess board
The n-queens puzzle is the problem of placing n queens on an n✕n chessboard such that no two queens attack each other.
Given an integer n, this code returns the number of distinct solutions to the n-...
4
votes
4
answers
680
views
N-Queens without recursion (but with one goto)
Compared to the recursive version e.g. on Rosetta, this is 5-10% faster and uses 50% less instructions (for N=12).
Only problem is the goto. Can it be avoided ...
5
votes
1
answer
267
views
Finding number of solutions nqueens 14 by 14 chessboard
I have written a code to solve the N-Queen problem for a 14 by 14 chessboard. There are preplaced queens (see below for the sample input and output). The lines of sample input (after the 3) represent ...
5
votes
1
answer
227
views
Solution to the n-queens puzzle in Ruby
I started studying programming in January of this year and found a free online course that teaches Ruby. Below is my solution to the Eight Queens problem.
I wanted my solution to be able to return any ...
4
votes
2
answers
712
views
A solution for n-queens in C
This is a code I wrote for solving the famous nqueens problem. It returns only the first solution. I would like your reviews and comments and ways to convert it to a solution which will return a set ...
4
votes
0
answers
181
views
N-Queens Puzzle
The N-Queens puzzle can be solved in many ways. One is by a depth-first-search backtracking algorithm.
Below is my generalized version using mutual recursion:
...
2
votes
1
answer
115
views
Improved Backtracking with nqueen
I am implementing conflict-based backjumping with nqueen. I want to optimize my code especially in recursive call.
In short,backjumping is similar to backtracking and it uses conflict set. When ...
2
votes
1
answer
316
views
n-queens problems and permutation strategy
I would like to write a C++ code for the n-queens problem using the permutation approach. This means I index the queens from 1 to n, and the state of the checkerboard will be defined by an array where ...
4
votes
1
answer
420
views
N queens problem in python
I just tried to create a program for the N queens problem.
...
- The Overflow Blog
-
-
- Featured on Meta
-
-
Related Tags
algorithm × 10
backtracking × 10
java × 10
python × 10
performance × 9
c++ × 9
chess × 8
recursion × 6
python-3.x × 5
multithreading × 4
haskell × 3
c × 2
assembly × 2
f# × 2
combinatorics × 2
iterator × 2
x86 × 1
racket × 1
sicp × 1
scheme × 1
ruby × 1
numpy × 1
more related tags
Hot Network Questions
- Why aren't there baleen whales at about the size of a dolphin?
- What does this word "ahn-shdah-heh" mean?
- When was the last time all alive humans stayed on earth?
- Word order for a phrase with a number, adjective and noun
- Why does the node Bounding Box suddenly produce a different result in version 4.5?
- Heavy shelves, but not a center stud
- Are you required to protect trade secrets revealed to you even if you didn't sign an NDA?
- Tracking stored procedure performance metrics
- What's the difference between an eVisa and ETA travel authorization?
- The Russian president is struggling to pass a law now. Then, how much power does Kremlin have to initiate a congressional decision?
- Heretofore I think I have been using 'heretofore' incorrectly
- I don't have enough alive employees to start the day. What now?
- A question about as ..... as comparison
- Easy ways to draw vector diagrams in TikZ?
- Automatic drawing of polygon around selected polygons in QGIS
- Pairwise comparisons with emmeans in a linear mixed-effects model
- Consecutive no-date author-year citations by the same author produce inconsistent suffixes
- A national poll of 1000 French returns 25% of "Yes". Is it enough to say that it's quite impossible locally to be 0%, if we don't know the variance?
- Is there such a thing as 'aerospace grade software'?
- Is it possible to use the PC power button to pre-select the OS in rEFInd UEFI dual boot setup?
- Why exactly do full-flow rocket engine's turbopumps run cooler?
- Balancing a Holy Water Bomb
- "I met a monk and philosopher." How many people did I meet?
- What does it mean to "cancel" a command in the linux kernel and how can one do so?