How do i generate all possible subsets of an binary string?

后端 未结 5 1989
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 22:06

i have a problem, that i don\'t know how to solve it.

i have a binary string and i want to generate all possible binary substrings.

Example :



        
5条回答
  •  执念已碎
    2021-01-20 22:47

    1. If you just want values that are below the numeric value of the binary string, keep taking one away from the binary string until you get to 0.
    2. If you want all values that can be represented by that number of binary digits, subtract 1 from the highest number that can be represented by that number of digits until you get to 0.

    This kind of question appears on those code katcha sites

提交回复
热议问题