1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 23:41:41 +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

@@ -12,7 +12,7 @@
"translatedContent": "<p>「句子」是一个用空格分隔单词的字符串。给你一个满足下述格式的句子 <code>text</code> :</p>\n\n<ul>\n\t<li>句子的首字母大写</li>\n\t<li><code>text</code> 中的每个单词都用单个空格分隔。</li>\n</ul>\n\n<p>请你重新排列 <code>text</code> 中的单词,使所有单词按其长度的升序排列。如果两个单词的长度相同,则保留其在原句子中的相对顺序。</p>\n\n<p>请同样按上述格式返回新的句子。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>text = &quot;Leetcode is cool&quot;\n<strong>输出:</strong>&quot;Is cool leetcode&quot;\n<strong>解释:</strong>句子中共有 3 个单词,长度为 8 的 &quot;Leetcode&quot; ,长度为 2 的 &quot;is&quot; 以及长度为 4 的 &quot;cool&quot; 。\n输出需要按单词的长度升序排列新句子中的第一个单词首字母需要大写。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>text = &quot;Keep calm and code on&quot;\n<strong>输出:</strong>&quot;On and keep calm code&quot;\n<strong>解释:</strong>输出的排序情况如下:\n&quot;On&quot; 2 个字母。\n&quot;and&quot; 3 个字母。\n&quot;keep&quot; 4 个字母,因为存在长度相同的其他单词,所以它们之间需要保留在原句子中的相对顺序。\n&quot;calm&quot; 4 个字母。\n&quot;code&quot; 4 个字母。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>text = &quot;To be or not to be&quot;\n<strong>输出:</strong>&quot;To be or to be not&quot;\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>text</code> 以大写字母开头,然后包含若干小写字母以及单词间的单个空格。</li>\n\t<li><code>1 &lt;= text.length &lt;= 10^5</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 27,
"likes": 29,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"11.2K\", \"totalSubmission\": \"21.2K\", \"totalAcceptedRaw\": 11242, \"totalSubmissionRaw\": 21240, \"acRate\": \"52.9%\"}",
"stats": "{\"totalAccepted\": \"11.4K\", \"totalSubmission\": \"21.6K\", \"totalAcceptedRaw\": 11428, \"totalSubmissionRaw\": 21561, \"acRate\": \"53.0%\"}",
"hints": [
"Store each word and their relative position. Then, sort them by length of words in case of tie by their original order."
],