mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-25 23:08:57 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>特殊的二进制序列是具有以下两个性质的二进制序列:</p>\n\n<ul>\n\t<li>0 的数量与 1 的数量相等。</li>\n\t<li>二进制序列的每一个前缀码中 1 的数量要大于等于 0 的数量。</li>\n</ul>\n\n<p>给定一个特殊的二进制序列 <code>S</code>,以字符串形式表示。定义一个<em>操作 </em>为首先选择 <code>S</code> 的两个连续且非空的特殊的子串,然后将它们交换。(两个子串为连续的当且仅当第一个子串的最后一个字符恰好为第二个子串的第一个字符的前一个字符。)</p>\n\n<p>在任意次数的操作之后,交换后的字符串按照字典序排列的最大的结果是什么?</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> S = "11011000"\n<strong>输出:</strong> "11100100"\n<strong>解释:</strong>\n将子串 "10" (在S[1]出现) 和 "1100" (在S[3]出现)进行交换。\n这是在进行若干次操作后按字典序排列最大的结果。\n</pre>\n\n<p><strong>说明:</strong></p>\n\n<ol>\n\t<li><code>S</code> 的长度不超过 <code>50</code>。</li>\n\t<li><code>S</code> 保证为一个满足上述定义的<em>特殊 </em>的二进制序列。</li>\n</ol>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 79,
|
||||
"likes": 81,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Valid Parenthesis String\", \"titleSlug\": \"valid-parenthesis-string\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6709\\u6548\\u7684\\u62ec\\u53f7\\u5b57\\u7b26\\u4e32\"}]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.4K\", \"totalSubmission\": \"4K\", \"totalAcceptedRaw\": 2360, \"totalSubmissionRaw\": 3976, \"acRate\": \"59.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.4K\", \"totalSubmission\": \"4.1K\", \"totalAcceptedRaw\": 2417, \"totalSubmissionRaw\": 4065, \"acRate\": \"59.5%\"}",
|
||||
"hints": [
|
||||
"Draw a line from (x, y) to (x+1, y+1) if we see a \"1\", else to (x+1, y-1).\r\nA special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached.\r\nCall a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest y-coordinate reached.\r\nIf F is the answer function, and S has mountain decomposition M1,M2,M3,...,Mk, then the answer is:\r\nreverse_sorted(F(M1), F(M2), ..., F(Mk)).\r\nHowever, you'll also need to deal with the case that S is a mountain, such as 11011000 -> 11100100."
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user