Given a binary string of 0 and 1. You can choose any substring of given size K and invert all bits in that substring ( 0 to 1 and 1 to 0) . Return true if u can make all 0 else return false

Example

1001

K=2

Ans - yes (0101-> 0011-> 0000)

Given a binary string of 0 and 1. You can choose any substring of given size K and invert all bits in that substring ( 0 to 1 and 1 to 0) . Return true if u can make all 0 else return false

Example

1001

K=2

Ans - yes (0101-> 0011-> 0000)

What is the time complexity requirement?

If O(N^2) works well then you can simply brute-force to check for all possible scenarios.

N and K is 10^5…brute force wont work also i dont see any brute force N^2 here…how do you try every posibility in N^2?

yeah thanks!

think this is some hiring contest problem . other threads also there regarding thi ,

and from the past history of @invincible1212 , his solutions in june cookoff , its more suspicious