mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两个字符串 <code>s</code> 和 <code>t</code> ,请你找出 <code>s</code> 中的非空子串的数目,这些子串满足替换 <strong>一个不同字符</strong> 以后,是 <code>t</code> 串的子串。换言之,请你找到 <code>s</code> 和 <code>t</code> 串中 <strong>恰好</strong> 只有一个字符不同的子字符串对的数目。</p>\n\n<p>比方说, <code>\"<strong>compute</strong>r\"</code> 和 <code>\"<strong>computa</strong>tion\"</code> 加粗部分只有一个字符不同: <code>'e'</code>/<code>'a'</code> ,所以这一对子字符串会给答案加 1 。</p>\n\n<p>请你返回满足上述条件的不同子字符串对数目。</p>\n\n<p>一个 <strong>子字符串</strong> 是一个字符串中连续的字符。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>s = \"aba\", t = \"baba\"\n<b>输出:</b>6\n<strong>解释:</strong>以下为只相差 1 个字符的 s 和 t 串的子字符串对:\n(\"<strong>a</strong>ba\", \"<strong>b</strong>aba\")\n(\"<strong>a</strong>ba\", \"ba<strong>b</strong>a\")\n(\"ab<strong>a</strong>\", \"<strong>b</strong>aba\")\n(\"ab<strong>a</strong>\", \"ba<strong>b</strong>a\")\n(\"a<strong>b</strong>a\", \"b<strong>a</strong>ba\")\n(\"a<strong>b</strong>a\", \"bab<strong>a</strong>\")\n加粗部分分别表示 s 和 t 串选出来的子字符串。\n</pre>\n<strong>示例 2:</strong>\n\n<pre>\n<b>输入:</b>s = \"ab\", t = \"bb\"\n<b>输出:</b>3\n<strong>解释:</strong>以下为只相差 1 个字符的 s 和 t 串的子字符串对:\n(\"<strong>a</strong>b\", \"<strong>b</strong>b\")\n(\"<strong>a</strong>b\", \"b<strong>b</strong>\")\n(\"<strong>ab</strong>\", \"<strong>bb</strong>\")\n加粗部分分别表示 s 和 t 串选出来的子字符串。\n</pre>\n<strong>示例 3:</strong>\n\n<pre>\n<b>输入:</b>s = \"a\", t = \"a\"\n<b>输出:</b>0\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<b>输入:</b>s = \"abe\", t = \"bbc\"\n<b>输出:</b>10\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length, t.length <= 100</code></li>\n\t<li><code>s</code> 和 <code>t</code> 都只包含小写英文字母。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 39,
|
||||
"likes": 41,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.4K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 3425, \"totalSubmissionRaw\": 4787, \"acRate\": \"71.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"4.9K\", \"totalAcceptedRaw\": 3518, \"totalSubmissionRaw\": 4907, \"acRate\": \"71.7%\"}",
|
||||
"hints": [
|
||||
"Take every substring of s, change a character, and see how many substrings of t match that substring.",
|
||||
"Use a Trie to store all substrings of t as a dictionary."
|
||||
|
Reference in New Issue
Block a user