A more optimized implementation of n-queens algorithm in scala.