#given a binary string w of length k0,find all strings of length nk that do not contain w as a

5 messages · Page 1 of 1 (latest)

wise oceanBOT
keen crag
#

What do you know about counting binary strings?

scenic nexus
#

Algorithm or programming?
I think it is solved in the following way:
The first condition that must be check is length n >k
And then you have n-k subsequences to verify
Every subsequence
s[i : i+k]?=w, 0 >i>n-k+1
i++
I think the solution looks like this

keen crag
#

Oh, subsequence makes this an interesting question. I thought this was going to be a large application of inclusion/exclusion

#

Are you trying to write a program that outputs a list of them or are you just trying to count them?