Sunday, October 21, 2018

Problem statement understanding - reading challenge

Oct. 21, 2018

Introduction


It is the algorithm I made a few mistakes in understanding in the weekly contest called 926 Flip string to montone increasing.

A few misunderstanings


There are a few misunderstandings, I highlight those place I missed in my 10 minutes thinking in the contest.

A string of '0's and '1's is monotone increasing if it consists of some number of '0's (possibly 0), followed by some number of '1's (also possibly 0.)
We are given a string S of '0's and '1's, and we may flip any '0' to a '1' or a '1' to a '0'.
Return the minimum number of flips to make S monotone increasing.

More detail about understanding:
1. all 0's is fine as an answer
2. all 1's is fine as an answer
3. The string is in pattern of 0's followed by 1's, but my thinking is more complicated, 0's followed by 1's and then continue to have 0's, followed by 1's. I just made the problem very hard and may not have an answer. 

No comments:

Post a Comment