Name: Anonymous 2012-01-19 18:10
How can I generate all binary strings of n length with m ones? (in delphi)
sample: n=3 m=2:
110
101
011
sample: n=3 m=2:
110
101
011
((M←3)=+/A)⌿A←⍉(N/2)⊤⍳2*N←5
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 0
1 1 1 0 0