K – balanced string solution codechef

K – balanced string solution codechef For Solution Click Here! A binary string SS of length NN is called KK-balanced string if it holds the following property: For each index i(1≤i≤N)i(1≤i≤N) such that Si=Si= ‘1’, there must exist an index j(1≤j≤N)j(1≤j≤N) such that Sj=Sj= ‘1’ and ∣i−j∣=K∣i−j∣=K, where ∣x∣∣x∣ denotes the absolute value of xx. For example, if K=1K=1, Continue reading K – balanced string solution codechef