N Queens

The n-Queens problem

The n-queens problem is a classic combinatorial problem. It is required to place n queens on an n×n chess board so that no two queens threaten each other. Therefore no two queens can be on the same row, column or diagonal. There must be a queen on each column and all their row numbers must differ so a solution can be represented as a permutation of the rows. (Not all permutations are solutions.)


Elegant solution in Haskell


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License