N Queen problem, a Scala implementation.

The N Queen is the problem of placing N chess queens on anN×N chessboard so that no two queens attack each other. For example, following is a solution for 4 Queen problem. The expected output is a binary matrix which has 1s for the blocks where queens are placed. http://www.geeksforgeeks.org/backtracking-set-3-n-queen-problem/ Using Sets and for-expressions with Scala we can reach a solution very directly: def queens(n: Int): Set[List[Int]] = { def […]