Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1'sby LanX (Saint) |
on Sep 18, 2020 at 08:43 UTC ( [id://11121899]=note: print w/replies, xml ) | Need Help?? |
There is a straight forward solution if the numbers of 1s are fixed. I've realized too late that that number is supposed to be free too, so you need recursion (or fake it). For completeness:
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|