Ah, in the case of looking for all n-digit bit-strings that contain exactly
m-1's, the recursive solution is even nicer. Here's how I think of it:
Base Case(s):
- if you want 0 1's (m==0) then return all 0's.
- if you want all 1's (n==m) then return all 1's.
Otherwise Recursive Case:
- return th
The 2**n different lists that you are seeking have a direct association to
the binary representation of the integers 0 through (2**n)-1.
You can use this fact and the "repeated division method" for converting
numbers between different bases to generate these lists and form the desired
list of list