Skip to content

Fix n-queens problem #12583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 22, 2025
Merged

Conversation

infrablue1
Copy link
Contributor

Describe your change:

Fix wrong solution for n-queens problem which in backtrace folder.

Details

There is an issue about n_queens.py. If I run this script, it will print the wrong result which is different with n_queens_math.py. I think it's enough to check left upper diagonal, right upper diagonal and the same column here. Here are the last few lines of the correct output with my changes:

. . . . . . . Q
. . . Q . . . .
Q . . . . . . .
. . Q . . . . .
. . . . . Q . .
. Q . . . . . .
. . . . . . Q .
. . . . Q . . .
The total number of solutions are: 92

@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Feb 18, 2025
@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Feb 20, 2025
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Feb 20, 2025
@MaximSmolskiy
Copy link
Member

@cclauss Can we do something about this?

The job was not started because recent account payments have failed or your spending limit needs to be increased. Please check the 'Billing & plans' section in your settings.

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Feb 22, 2025
@MaximSmolskiy MaximSmolskiy changed the title Fix n-queues problem Fix n-queens problem Feb 22, 2025
@MaximSmolskiy MaximSmolskiy merged commit 183fa06 into TheAlgorithms:master Feb 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants