-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Create program.c #1344
Create program.c #1344
Conversation
The N-Queens Problem is a classic problem where the objective is to place N queens on an N x N chessboard such that no two queens can attack each other. A queen can attack any other piece in the same row, column, or diagonal, making it challenging to place all N queens without conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hi @kaabilcoder! Thank you for submitting your first pull request to the Algo project. Great job on the contribution! 🎉 We appreciate your efforts, and our team will review it soon. If you have any questions, feel free to ask. Keep up the great work! 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Great job, @kaabilcoder! Thank you for submitting your pull request. We appreciate your contribution, and our team will review it shortly.
⚡️ Lighthouse Report for the Deploy Preview of this PR 🚀
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please carefully read our contribution guidelines for docs and we need only .md
files for our docs so, you can delete your docs/backtracking algorithms/program.c
file
got it |
The N-Queens Problem is a classic problem where the objective is to place N queens on an N x N chessboard such that no two queens can attack each other. A queen can attack any other piece in the same row, column, or diagonal, making it challenging to place all N queens without conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update your code based on our suggestion
updated the code, it's format and syntax as per the guidelines and suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update your code based on suggestions
Updated the given suggestions on this code.
Thank you sir for your suggestion! I have updated the changes which you
have mentioned so please review the check once and also by mistakely i have
been removed from the assignee by mistakely clicked the unassign button. So
i request to reassign this issue to me again and review my code.
…On Sun, 3 Nov 2024 at 12:37, Ajay Dhangar ***@***.***> wrote:
***@***.**** requested changes on this pull request.
update your code based on suggestions
------------------------------
In docs/backtracking algorithms/N-QueensProblem.md
<#1344 (comment)>:
> @@ -0,0 +1,149 @@
+---
+id: N-Queens Problem
replace id: N-Queens Problem with id: n-queens-problem
------------------------------
In docs/backtracking algorithms/N-QueensProblem.md
<#1344 (comment)>:
> +3. Check if placing a queen is safe (no other queens can attack it).
+4. If safe, place the queen and move to the next row.
+5. If a position is not safe or leads to no solution, backtrack by removing the queen and trying a different column.
+6. Repeat until all queens are placed or no solution is found.
+
+### Functions:
+1. **isSafe(row, col)**: Checks if placing a queen at `(row, col)` is safe.
+2. **solveNQueens(row)**: Recursively places queens row by row and uses backtracking when necessary.
+3. **printSolution()**: Displays a valid chessboard configuration.
+
+## Time Complexity
+
+The time complexity for solving the N-Queens problem using backtracking is `O(N!)`, since we try placing a queen in every column of each row and backtrack if needed.
+
+## Program:
+```
replace line 43 ``` with ```c
—
Reply to this email directly, view it on GitHub
<#1344 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BIY6COQP26B74UWS6LGR7LDZ6XDRRAVCNFSM6AAAAABQVNRIB2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDIMJRG44TCNZVGE>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
🎉🎉 Thank you for your contribution! Your PR #1344 has been merged! 🎉🎉 |
The N-Queens Problem is a classic problem where the objective is to place N queens on an N x N chessboard such that no two queens can attack each other. A queen can attack any other piece in the same row, column, or diagonal, making it challenging to place all N queens without conflict.