You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.)
3
+
4
+
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'.
5
+
6
+
Return the minimum number of flips to make S monotone increasing.
7
+
8
+
9
+
10
+
Example 1:
11
+
12
+
Input: "00110"
13
+
Output: 1
14
+
Explanation: We flip the last digit to get 00111.
15
+
Example 2:
16
+
17
+
Input: "010110"
18
+
Output: 2
19
+
Explanation: We flip to get 011111, or alternatively 000111.
0 commit comments