mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个仅由字符 <code>'0'</code> 和 <code>'1'</code> 组成的字符串 <code>s</code> 。一步操作中,你可以将任一 <code>'0'</code> 变成 <code>'1'</code> ,或者将 <code>'1'</code> 变成 <code>'0'</code> 。</p>\n\n<p><strong>交替字符串</strong> 定义为:如果字符串中不存在相邻两个字符相等的情况,那么该字符串就是交替字符串。例如,字符串 <code>\"010\"</code> 是交替字符串,而字符串 <code>\"0100\"</code> 不是。</p>\n\n<p>返回使 <code>s</code> 变成 <strong>交替字符串</strong> 所需的 <strong>最少</strong> 操作数。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>s = \"0100\"\n<strong>输出:</strong>1\n<strong>解释:</strong>如果将最后一个字符变为 '1' ,s 就变成 \"0101\" ,即符合交替字符串定义。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>s = \"10\"\n<strong>输出:</strong>0\n<strong>解释:</strong>s 已经是交替字符串。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>s = \"1111\"\n<strong>输出:</strong>2\n<strong>解释:</strong>需要 2 步操作得到 \"0101\" 或 \"1010\" 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 10<sup>4</sup></code></li>\n\t<li><code>s[i]</code> 是 <code>'0'</code> 或 <code>'1'</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 33,
|
||||
"likes": 34,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.5K\", \"totalSubmission\": \"13.2K\", \"totalAcceptedRaw\": 8453, \"totalSubmissionRaw\": 13166, \"acRate\": \"64.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 8741, \"totalSubmissionRaw\": 13672, \"acRate\": \"63.9%\"}",
|
||||
"hints": [
|
||||
"Think about how the final string will look like.",
|
||||
"It will either start with a '0' and be like '010101010..' or with a '1' and be like '10101010..'",
|
||||
|
Reference in New Issue
Block a user