1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-03 06:22:54 +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>\"Hello World\"</code> <code>\"HELLO\"</code> <code>\"hello world hello world\"</code> 都是句子。每个单词都 <strong>只</strong> 包含大写和小写英文字母。</p>\n\n<p>如果两个句子 <code>sentence1</code> 和 <code>sentence2</code> ,可以通过往其中一个句子插入一个任意的句子(<strong>可以是空句子</strong>)而得到另一个句子,那么我们称这两个句子是 <strong>相似的</strong> 。比方说,<code>sentence1 = \"Hello my name is Jane\"</code> 且 <code>sentence2 = \"Hello Jane\"</code> ,我们可以往 <code>sentence2</code> 中 <code>\"Hello\"</code> 和 <code>\"Jane\"</code> 之间插入 <code>\"my name is\"</code> 得到 <code>sentence1</code> 。</p>\n\n<p>给你两个句子 <code>sentence1</code> 和 <code>sentence2</code> ,如果<em> </em><code>sentence1</code> 和<em> </em><code>sentence2</code> 是相似的,请你返回 <code>true</code> ,否则返回 <code>false</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><b>输入:</b>sentence1 = \"My name is Haley\", sentence2 = \"My Haley\"\n<b>输出:</b>true\n<b>解释:</b>可以往 sentence2 中 \"My\" 和 \"Haley\" 之间插入 \"name is\" ,得到 sentence1 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>sentence1 = \"of\", sentence2 = \"A lot of words\"\n<b>输出:</b>false\n<strong>解释:</strong>没法往这两个句子中的一个句子只插入一个句子就得到另一个句子。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><b>输入:</b>sentence1 = \"Eating right now\", sentence2 = \"Eating\"\n<b>输出:</b>true\n<b>解释:</b>可以往 sentence2 的结尾插入 \"right now\" 得到 sentence1 。\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre><b>输入:</b>sentence1 = \"Luky\", sentence2 = \"Lucccky\"\n<b>输出:</b>false\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= sentence1.length, sentence2.length &lt;= 100</code></li>\n\t<li><code>sentence1</code> 和 <code>sentence2</code> 都只包含大小写英文字母和空格。</li>\n\t<li><code>sentence1</code> 和 <code>sentence2</code> 中的单词都只由单个空格隔开。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 15,
"likes": 16,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.9K\", \"totalSubmission\": \"12.2K\", \"totalAcceptedRaw\": 5936, \"totalSubmissionRaw\": 12222, \"acRate\": \"48.6%\"}",
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"12.5K\", \"totalAcceptedRaw\": 6028, \"totalSubmissionRaw\": 12502, \"acRate\": \"48.2%\"}",
"hints": [
"One way to look at it is to find one sentence as a concatenation of a prefix and suffix from the other sentence.",
"Get the longest common prefix between them and the longest common suffix."