Can You Beat The British Intelligence? (Nonogram Solver)
Answer : Haskell, 242 230 201 199 177 163 160 149 131 bytes import Data.Lists m=map a#b=[x|x<-m(chunk$length b).mapM id$[0,1]<$(a>>b),g x==a,g(transpose x)==b] g=m$list[0]id.m sum.wordsBy(<1) Finally under 200 bytes, credit to @Bergi. Huge thanks to @nimi for helping almost halving the size. Wow. Almost at half size now, partly because of me but mainly because of @nimi. The magic function is (#) . It finds all solutions of a given nonogram. This is able to solve all cases, but may be super slow, since it's complexity is about O(2^(len a * len b)) . A quick benchmark revealed 86GB allocated for a 5x5 nonogram. Fun fact: It works for all nonograms, not only square ones. How it works: a#b : Given lists of lists of integers which represent the number of squares, generate all grids ( map(chunk$length b).mapM id$a>>b>>[[0,1]] ) and filter the results to keep only the valid ones. g : Given a potential nonogram it sums the runs of 1's...