1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 05:26:46 +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

@@ -7,12 +7,12 @@
"boundTopicId": 910311,
"title": "相似的字符串",
"titleSlug": "H6lPxb",
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>\n",
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>",
"translatedTitle": "相似的字符串",
"translatedContent": "<p>如果交换字符串&nbsp;<code>X</code> 中的两个不同位置的字母,使得它和字符串&nbsp;<code>Y</code> 相等,那么称 <code>X</code> 和 <code>Y</code> 两个字符串相似。如果这两个字符串本身是相等的,那它们也是相似的。</p>\n\n<p>例如,<code>&quot;tars&quot;</code> 和 <code>&quot;rats&quot;</code> 是相似的 (交换 <code>0</code> 与 <code>2</code> 的位置)&nbsp;<code>&quot;rats&quot;</code> 和 <code>&quot;arts&quot;</code> 也是相似的,但是 <code>&quot;star&quot;</code> 不与 <code>&quot;tars&quot;</code><code>&quot;rats&quot;</code>,或 <code>&quot;arts&quot;</code> 相似。</p>\n\n<p>总之,它们通过相似性形成了两个关联组:<code>{&quot;tars&quot;, &quot;rats&quot;, &quot;arts&quot;}</code> 和 <code>{&quot;star&quot;}</code>。注意,<code>&quot;tars&quot;</code> 和 <code>&quot;arts&quot;</code> 是在同一组中,即使它们并不相似。形式上,对每个组而言,要确定一个单词在组中,只需要这个词和该组中至少一个单词相似。</p>\n\n<p>给定一个字符串列表 <code>strs</code>。列表中的每个字符串都是 <code>strs</code> 中其它所有字符串的一个&nbsp;<strong>字母异位词&nbsp;</strong>。请问 <code>strs</code> 中有多少个相似字符串组?</p>\n\n<p><strong>字母异位词anagram</strong>,一种把某个字符串的字母的位置(顺序)加以改换所形成的新词。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>strs = [&quot;tars&quot;,&quot;rats&quot;,&quot;arts&quot;,&quot;star&quot;]\n<strong>输出:</strong>2\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>strs = [&quot;omv&quot;,&quot;ovm&quot;]\n<strong>输出:</strong>1\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= strs.length &lt;= 300</code></li>\n\t<li><code>1 &lt;= strs[i].length &lt;= 300</code></li>\n\t<li><code>strs[i]</code> 只包含小写字母。</li>\n\t<li><code>strs</code> 中的所有单词都具有相同的长度,且是彼此的字母异位词。</li>\n</ul>\n\n<p>&nbsp; &nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 839&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/similar-string-groups/\">https://leetcode-cn.com/problems/similar-string-groups/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 9,
"likes": 10,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -44,6 +44,12 @@
"translatedName": "并查集",
"__typename": "TopicTagNode"
},
{
"name": "Array",
"slug": "array",
"translatedName": "数组",
"__typename": "TopicTagNode"
},
{
"name": "String",
"slug": "string",
@@ -162,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"4.6K\", \"totalAcceptedRaw\": 2911, \"totalSubmissionRaw\": 4595, \"acRate\": \"63.4%\"}",
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"5.6K\", \"totalAcceptedRaw\": 3544, \"totalSubmissionRaw\": 5641, \"acRate\": \"62.8%\"}",
"hints": [],
"solution": null,
"status": null,