Tuesday, June 9, 2015

Leetcode: N puzzle queens

Read the blogs, and understand the algorithm first:

N-Queens

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, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuration of the n-queens’ placement, where 'Q' and '.' both indicate a queen and an empty space respectively.

http://www.acmerblog.com/leetcode-solution-n-queens-6254.html
 
http://blog.csdn.net/feixiaoxing/article/details/6877965

and later, wrote the program using C#, share the code:

Algorithm: Eight puzzle queen
https://github.com/jianminchen/eightPuzzleQueen/blob/master/Program.cs

https://github.com/jianminchen/Leetcode_C-/blob/master/51NQueenProblems.cs

January 12, 2016

Review the algorithm again. The following blog gives a good explanation, help me understand the algorithm better.

http://blog.csdn.net/linhuanmars/article/details/20667175

http://buttercola.blogspot.ca/search/label/Leetcode

http://yucoding.blogspot.ca/2013/01/leetcode-question-59-n-queens.html

https://polythinking.wordpress.com/2013/02/27/leetcoden-queens-i-and-ii/

It is fun to read solutions in C++/Java.


No comments:

Post a Comment