Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

1
  • $\begingroup$ You might ask why $list=[0,0,0,0,0,1,1,0]$? Let's say you have 3 bits here, and you want $′101′$(=5) and $′110′$(=6). If you generate all possible bit-strings with 3 bits you'll have $′000′,′001′....′111′$ and you can easily see your target bit-strings are the 6th and 7th. Hence the 6th (5+1) and 7th (6+1) elements in the $list$ are 1. $\endgroup$ Commented Mar 7, 2021 at 8:23