This question is not a duplicate of this question. I'm not counting specific digits, as we already have those set in the initial parameters. This question is focusing on the decimal numbers that can be constructed from the binary strings based on the digits provided.
Given two integers
Y, representing the number of zeroes (
0) and ones (
1) respectively, calculate all the possible decimal equivalents that can be determined from creating binary strings using only the zeroes and ones provided, and display them as output.
Explanation: Only one
1 to account for, which can only be converted one way.
01 converts to 1,
10 converts to 2.
0s and two
Limitations and Rules
- I will only expect your code to work where
0 < X + Y <= 16so the maximum number in the output could only occur from 16
1s, i.e. parameters
- As a result of the above limitation, the range of numbers we'd expect in the output are from
- I will accept functions or code, so long as the resulting output is provided, whether this be a comma separated list, an array, list outputted to STDOUT, etc. The only criteria I must stress about the output is that it must be sorted.
- This is code golf, minimum bytes will receive maximum glory.
- We will not tolerate silly loopholes