1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/回文对 [palindrome-pairs].html
2022-03-29 12:43:11 +08:00

35 lines
1.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一组<strong> 互不相同</strong> 的单词, 找出所有<strong> 不同<em> </em></strong>的索引对 <code>(i, j)</code>,使得列表中的两个单词, <code>words[i] + words[j]</code> ,可拼接成回文串。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>words = ["abcd","dcba","lls","s","sssll"]
<strong>输出:</strong>[[0,1],[1,0],[3,2],[2,4]]
<strong>解释:</strong>可拼接成的回文串为 <code>["dcbaabcd","abcddcba","slls","llssssll"]</code>
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>words = ["bat","tab","cat"]
<strong>输出:</strong>[[0,1],[1,0]]
<strong>解释:</strong>可拼接成的回文串为 <code>["battab","tabbat"]</code></pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>words = ["a",""]
<strong>输出:</strong>[[0,1],[1,0]]
</pre>
 
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= words.length <= 5000</code></li>
<li><code>0 <= words[i].length <= 300</code></li>
<li><code>words[i]</code> 由小写英文字母组成</li>
</ul>