LZRW - Editorial

PROBLEM LINKS:

practice

contest

Difficulty:

Easy

Pre-requirements:

Greedy Techniques

Problem:

Given a binary string of 0s and 1s. Find the minimum number of flips required to change the string such that it does’nt contain the substring 101.

Explanation:

Iterate from left to right and change every substring 101 to 100.

Count number of such changes.

complexity: O(N) for each Test case.

Authors Solution:

can be found here