Comment on N-queen puzzle in 4 lines of ScalaComments−Bladtman10yBy someone who clearly cannot count to 4?−pathikritOP10yOP here. Sorry for the code-golfy post on HN. But, some clarifications:1. Yes, it is O(n!) - it says so in the description but not on the title of the post on HN.2. It is 4 lines of code for `nQueen` function. I did not include the printing code in the line count.3. And no, I did not cheat by using semicolons in same lines - these are 4 legit lines IMO. You can put the `&` clause in 1 line to reduce it further.
Comments
By someone who clearly cannot count to 4?
OP here. Sorry for the code-golfy post on HN. But, some clarifications:
1. Yes, it is O(n!) - it says so in the description but not on the title of the post on HN.
2. It is 4 lines of code for `nQueen` function. I did not include the printing code in the line count.
3. And no, I did not cheat by using semicolons in same lines - these are 4 legit lines IMO. You can put the `&` clause in 1 line to reduce it further.