1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 23:11: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>一个 <strong>句子</strong>&nbsp;由一些 <strong>单词</strong>&nbsp;以及它们之间的单个空格组成,句子的开头和结尾不会有多余空格。</p>\n\n<p>给你一个字符串数组&nbsp;<code>sentences</code>&nbsp;,其中&nbsp;<code>sentences[i]</code>&nbsp;表示单个 <strong>句子</strong>&nbsp;。</p>\n\n<p>请你返回单个句子里 <strong>单词的最多数目</strong>&nbsp;。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>sentences = [\"alice and bob love leetcode\", \"i think so too\", <em><strong>\"this is great thanks very much\"</strong></em>]\n<b>输出:</b>6\n<b>解释:</b>\n- 第一个句子 \"alice and bob love leetcode\" 总共有 5 个单词。\n- 第二个句子 \"i think so too\" 总共有 4 个单词。\n- 第三个句子 \"this is great thanks very much\" 总共有 6 个单词。\n所以单个句子中有最多单词数的是第三个句子总共有 6 个单词。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>sentences = [\"please wait\", <em><strong>\"continue to fight\"</strong></em>, <em><strong>\"continue to win\"</strong></em>]\n<b>输出:</b>3\n<b>解释:</b>可能有多个句子有相同单词数。\n这个例子中第二个句子和第三个句子加粗斜体有相同数目的单词数。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= sentences.length &lt;= 100</code></li>\n\t<li><code>1 &lt;= sentences[i].length &lt;= 100</code></li>\n\t<li><code>sentences[i]</code>&nbsp;只包含小写英文字母和&nbsp;<code>' '</code>&nbsp;。</li>\n\t<li><code>sentences[i]</code>&nbsp;的开头和结尾都没有空格。</li>\n\t<li><code>sentences[i]</code>&nbsp;中所有单词由单个空格隔开。</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.1K\", \"totalSubmission\": \"10.5K\", \"totalAcceptedRaw\": 9105, \"totalSubmissionRaw\": 10532, \"acRate\": \"86.5%\"}",
"stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"11.7K\", \"totalAcceptedRaw\": 10053, \"totalSubmissionRaw\": 11669, \"acRate\": \"86.2%\"}",
"hints": [
"Process each sentence separately and count the number of words by looking for the number of space characters in the sentence and adding it by 1."
],