0
$\begingroup$

So my question is that let's say I have a bit string of length four. If it is illegal to have 3 1's in a row and 3 0's in a row then how many bit string of this type exists

I was thinking that in total combination of bit strings of length four there is $2^4$, but in this case there is 2+2 illegal combinations so the total is

$2^4-4$ is this correct?

$\endgroup$
2
  • $\begingroup$ Yes that's correct. $\endgroup$ Mar 17 '18 at 21:05
  • $\begingroup$ Are $0000$ and $1111$ allowed? $\endgroup$
    – Delong
    Mar 17 '18 at 21:09
0
$\begingroup$

No. There are $6$ illegal strings. Just write them out. Unless 'three in a row' means exactly three in a row ... but that's not how I would interpret that question ...

$\endgroup$
7
  • $\begingroup$ how is there 6? $\endgroup$
    – Joe Hansen
    Mar 17 '18 at 21:08
  • $\begingroup$ 0000,0001,1000,0111,1110,1111 $\endgroup$
    – Bram28
    Mar 17 '18 at 21:09
  • $\begingroup$ ahhh I forgot the four of the same $\endgroup$
    – Joe Hansen
    Mar 17 '18 at 21:10
  • $\begingroup$ so it should be $2^4-6$? $\endgroup$
    – Joe Hansen
    Mar 17 '18 at 21:10
  • $\begingroup$ @JoeHansen Exactly. But, like I said, maybe it means exactly three in a row .. but that's not how I read that question ... so yes, I think you need to rule out 0000 and 1111 as well $\endgroup$
    – Bram28
    Mar 17 '18 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.