Find the missing permutation: Difference between revisions
J: the data is not a part of the implementation
m (→{{header|C}}: linkified permutation sort) |
(J: the data is not a part of the implementation) |
||
Line 230:
=={{header|J}}==
<lang J>
missingPerms =:-.~ permutations @ {.</lang>▼
Or putting things together:▼
<lang j>missingPerms =: -.~ (A.~ i.@!@#) @ {.</lang>▼
Use:▼
<pre>deficientPermsList=: }: ] ;. _1 LF, 0 : 0
ABCD
CABD
Line 255 ⟶ 260:
DCAB
)
▲missingPerms =:-.~ permutations @ {.</lang>
▲Or putting things together:
▲<lang j>missingPerms =: -.~ (A.~ i.@!@#) @ {.</lang>
▲Use:
▲<pre> missingPerms deficientPermsList
DBAC</pre>
|