A transition can occur at an adjacent pair (i,i+1) where 1<=i<i+1<=n. Since there are k transitions, there are C(n-1,k) total number of ways that transitions can occur. But the string may start with a 1 or a 0 (after which its transitions uniquely determine the string). So there are a total of 2C(n-1,k) such strings.

lib/config.php:156: Notice: Undefined variable: accept

lib/DbaDatabase.php:134: Warning: dba_replace() [<a href='function.dba-replace'>function.dba-replace</a>]: You cannot perform a modification to a database without proper access