in reply to Re^4: One Zero variants_without_repetition
in thread One Zero variants_without_repetition

Perhaps if you told us what you were trying to achieve we might understand what it is that you actually need. Up to now every time someone suggests a new solution you have introduced a new requirement.

Tell us what you need this for and what the constraints are on the input parameters and what the requirements are for the output.

A fairly trivial change to the recursive code I gave will change it to work with a string of characters rather than a "string" of bits. You would still run into deep recursion issues with large numbers of ones and other solutions are likely to be faster (memory constraints on recursion are unlikely to be a factor though) however.


DWIM is Perl's answer to Gödel
  • Comment on Re^5: One Zero variants_without_repetition