RosettaCodeData/Task/N-queens-problem/J/n-queens-problem-1.j

5 lines
222 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
perm =: ! A.&i. ] NB. all permutations of integers 0 to y
comb2 =: (, #: I.@,@(</)&i.)~ NB. all size 2 combinations of integers 0 to y
mask =: [ */@:~:&(|@-/) {
queenst=: comb2 (] #"1~ mask)&.|: perm