1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -9,10 +9,10 @@
"titleSlug": "flip-string-to-monotone-increasing",
"content": "<p>A binary string is monotone increasing if it consists of some number of <code>0</code>&#39;s (possibly none), followed by some number of <code>1</code>&#39;s (also possibly none).</p>\n\n<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>\n\n<p>Return <em>the minimum number of flips to make </em><code>s</code><em> monotone increasing</em>.</p>\n\n<p>&nbsp;</p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = &quot;00110&quot;\n<strong>Output:</strong> 1\n<strong>Explanation:</strong> We flip the last digit to get 00111.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = &quot;010110&quot;\n<strong>Output:</strong> 2\n<strong>Explanation:</strong> We flip to get 011111, or alternatively 000111.\n</pre>\n\n<p><strong>Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = &quot;00011000&quot;\n<strong>Output:</strong> 2\n<strong>Explanation:</strong> We flip to get 00000000.\n</pre>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>s[i]</code> is either <code>&#39;0&#39;</code> or <code>&#39;1&#39;</code>.</li>\n</ul>\n",
"translatedTitle": "将字符串翻转到单调递增",
"translatedContent": "<p>如果一个由&nbsp;<code>'0'</code> 和 <code>'1'</code>&nbsp;组成的字符串,是以一些 <code>'0'</code>(可能没有 <code>'0'</code>)后面跟着一些 <code>'1'</code>(也可能没有 <code>'1'</code>)的形式组成的,那么该字符串是<em>单调递增</em>的。</p>\n\n<p>我们给出一个由字符 <code>'0'</code> 和 <code>'1'</code>&nbsp;组成的字符串&nbsp;<code>S</code>我们可以将任何&nbsp;<code>'0'</code> 翻转为&nbsp;<code>'1'</code>&nbsp;或者将&nbsp;<code>'1'</code>&nbsp;翻转为&nbsp;<code>'0'</code>。</p>\n\n<p>返回使 <code>S</code> 单调递增的最小翻转次数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"00110\"\n<strong>输出:</strong>1\n<strong>解释:</strong>我们翻转最后一位得到 00111.\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"010110\"\n<strong>输出:</strong>2\n<strong>解释:</strong>我们翻转得到 011111或者是 000111。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"00011000\"\n<strong>输出:</strong>2\n<strong>解释:</strong>我们翻转得到 00000000。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>S</code> 中只包含字符&nbsp;<code>'0'</code>&nbsp;和&nbsp;<code>'1'</code></li>\n</ul>\n",
"translatedContent": "<p>如果一个二进制字符串,是以一些 <code>0</code>(可能没有 <code>0</code>)后面跟着一些 <code>1</code>(也可能没有 <code>1</code>)的形式组成的,那么该字符串是 <strong>单调递增 </strong>的。</p>\n\n<p>给你一个二进制字符串 <code>s</code>可以将任何 <code>0</code> 翻转为 <code>1</code> 或者将 <code>1</code> 翻转为 <code>0</code> 。</p>\n\n<p>返回使 <code>s</code> 单调递增的最小翻转次数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"00110\"\n<strong>输出:</strong>1\n<strong>解释:</strong>翻转最后一位得到 00111.\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"010110\"\n<strong>输出:</strong>2\n<strong>解释:</strong>翻转得到 011111或者是 000111。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"00011000\"\n<strong>输出:</strong>2\n<strong>解释:</strong>翻转得到 00000000。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>s[i]</code> <code>'0'</code><code>'1'</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 143,
"likes": 148,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.3K\", \"totalSubmission\": \"16.9K\", \"totalAcceptedRaw\": 9320, \"totalSubmissionRaw\": 16950, \"acRate\": \"55.0%\"}",
"stats": "{\"totalAccepted\": \"9.8K\", \"totalSubmission\": \"17.6K\", \"totalAcceptedRaw\": 9790, \"totalSubmissionRaw\": 17648, \"acRate\": \"55.5%\"}",
"hints": [],
"solution": null,
"status": null,