1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-23 05:48:57 +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>一个 <strong>句子</strong> 指的是一个序列的单词用单个空格连接起来,且开头和结尾没有任何空格。每个单词都只包含小写或大写英文字母。</p>\n\n<p>我们可以给一个句子添加 <strong>从 1 开始的单词位置索引 </strong>,并且将句子中所有单词 <strong>打乱顺序</strong> 。</p>\n\n<ul>\n\t<li>比方说,句子 <code>\"This is a sentence\"</code> 可以被打乱顺序得到 <code>\"sentence4 a3 is2 This1\"</code> 或者 <code>\"is2 sentence4 This1 a3\"</code> 。</li>\n</ul>\n\n<p>给你一个 <strong>打乱顺序</strong> 的句子 <code>s</code> ,它包含的单词不超过 <code>9</code> 个,请你重新构造并得到原本顺序的句子。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<b>输入:</b>s = \"is2 sentence4 This1 a3\"\n<b>输出:</b>\"This is a sentence\"\n<b>解释:</b>将 s 中的单词按照初始位置排序,得到 \"This1 is2 a3 sentence4\" ,然后删除数字。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<b>输入:</b>s = \"Myself2 Me1 I4 and3\"\n<b>输出:</b>\"Me Myself and I\"\n<b>解释:</b>将 s 中的单词按照初始位置排序,得到 \"Me1 Myself2 and3 I4\" ,然后删除数字。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= s.length <= 200</code></li>\n\t<li><code>s</code> 只包含小写和大写英文字母、空格以及从 <code>1</code> 到 <code>9</code> 的数字。</li>\n\t<li><code>s</code> 中单词数目为 <code>1</code> 到 <code>9</code> 个。</li>\n\t<li><code>s</code> 中的单词由单个空格分隔。</li>\n\t<li><code>s</code> 不包含任何前导或者后缀空格。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 13,
"likes": 14,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.3K\", \"totalSubmission\": \"12.3K\", \"totalAcceptedRaw\": 9295, \"totalSubmissionRaw\": 12296, \"acRate\": \"75.6%\"}",
"stats": "{\"totalAccepted\": \"9.8K\", \"totalSubmission\": \"13K\", \"totalAcceptedRaw\": 9762, \"totalSubmissionRaw\": 13001, \"acRate\": \"75.1%\"}",
"hints": [
"Divide the string into the words as an array of strings",
"Sort the words by removing the last character from each word and sorting according to it"