Class Solution
java.lang.Object
g0901_1000.s0926_flip_string_to_monotone_increasing.Solution
926 - Flip String to Monotone Increasing.<p>Medium</p>
<p>A binary string is monotone increasing if it consists of some number of <code>0</code>’s (possibly none), followed by some number of <code>1</code>’s (also possibly none).</p>
<p>You are given a binary string <code>s</code>. You can flip <code>s[i]</code> changing it from <code>0</code> to <code>1</code> or from <code>1</code> to <code>0</code>.</p>
<p>Return <em>the minimum number of flips to make</em> <code>s</code> <em>monotone increasing</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “00110”</p>
<p><strong>Output:</strong> 1</p>
<p><strong>Explanation:</strong> We flip the last digit to get 00111.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “010110”</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> We flip to get 011111, or alternatively 000111.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> s = “00011000”</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> We flip to get 00000000.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
<li><code>s[i]</code> is either <code>'0'</code> or <code>'1'</code>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
minFlipsMonoIncr
-