Combinatoric: How many binary strings of length 4 have exact two zeroes?

45 Views Asked by At

I know the answer is 6 but I'm not sure the proper method to do it.

How I came to the answer is by shifting two zeroes to the right and count until it reach back to the start.

Starting with 2 zeroes:
0011
1001
1100
0110

Staggered 2 zeroes:
0101
1010

1

There are 1 best solutions below

0
On

There's nothing wrong with your method, but there's a general formula. You have to choose 2 objects (zeroes) among a total of 4 (the length of the string). That's basically the binomial coefficient $\binom{4}{2}$. So, in general, there are $\binom{n}{k}$ string of lenght $n$ with exactly $k$ zeroes ($0\leq k\leq n$).