mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 23:41:41 +08:00
update
This commit is contained in:
@@ -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> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>text = "Leetcode is cool"\n<strong>输出:</strong>"Is cool leetcode"\n<strong>解释:</strong>句子中共有 3 个单词,长度为 8 的 "Leetcode" ,长度为 2 的 "is" 以及长度为 4 的 "cool" 。\n输出需要按单词的长度升序排列,新句子中的第一个单词首字母需要大写。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>text = "Keep calm and code on"\n<strong>输出:</strong>"On and keep calm code"\n<strong>解释:</strong>输出的排序情况如下:\n"On" 2 个字母。\n"and" 3 个字母。\n"keep" 4 个字母,因为存在长度相同的其他单词,所以它们之间需要保留在原句子中的相对顺序。\n"calm" 4 个字母。\n"code" 4 个字母。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>text = "To be or not to be"\n<strong>输出:</strong>"To be or to be not"\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>text</code> 以大写字母开头,然后包含若干小写字母以及单词间的单个空格。</li>\n\t<li><code>1 <= text.length <= 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."
|
||||
],
|
||||
|
Reference in New Issue
Block a user