|
4 | 4 |
|
5 | 5 | ## Description
|
6 | 6 |
|
7 |
| -<p>Given a list of <b>unique</b> words, return all the pairs of the <b><i>distinct</i></b> indices <code>(i, j)</code> in the given list, so that the concatenation of the two words <code>words[i] + words[j]</code> is a palindrome.</p> |
| 7 | +<p>You are given a <strong>0-indexed</strong> array of <strong>unique</strong> strings <code>words</code>.</p> |
| 8 | + |
| 9 | +<p>A <strong>palindrome pair</strong> is a pair of integers <code>(i, j)</code> such that:</p> |
| 10 | + |
| 11 | +<ul> |
| 12 | + <li><code>0 <= i, j < word.length</code>,</li> |
| 13 | + <li><code>i != j</code>, and</li> |
| 14 | + <li><code>words[i] + words[j]</code> (the concatenation of the two strings) is a palindrome string.</li> |
| 15 | +</ul> |
| 16 | + |
| 17 | +<p>Return <em>an array of all the <strong>palindrome pairs</strong> of </em><code>words</code>.</p> |
8 | 18 |
|
9 | 19 | <p> </p>
|
10 |
| -<p><strong>Example 1:</strong></p> |
| 20 | +<p><strong class="example">Example 1:</strong></p> |
11 | 21 |
|
12 | 22 | <pre>
|
13 | 23 | <strong>Input:</strong> words = ["abcd","dcba","lls","s","sssll"]
|
14 | 24 | <strong>Output:</strong> [[0,1],[1,0],[3,2],[2,4]]
|
15 |
| -<strong>Explanation:</strong> The palindromes are ["dcbaabcd","abcddcba","slls","llssssll"] |
| 25 | +<strong>Explanation:</strong> The palindromes are ["abcddcba","dcbaabcd","slls","llssssll"] |
16 | 26 | </pre>
|
17 | 27 |
|
18 |
| -<p><strong>Example 2:</strong></p> |
| 28 | +<p><strong class="example">Example 2:</strong></p> |
19 | 29 |
|
20 | 30 | <pre>
|
21 | 31 | <strong>Input:</strong> words = ["bat","tab","cat"]
|
22 | 32 | <strong>Output:</strong> [[0,1],[1,0]]
|
23 | 33 | <strong>Explanation:</strong> The palindromes are ["battab","tabbat"]
|
24 | 34 | </pre>
|
25 | 35 |
|
26 |
| -<p><strong>Example 3:</strong></p> |
| 36 | +<p><strong class="example">Example 3:</strong></p> |
27 | 37 |
|
28 | 38 | <pre>
|
29 | 39 | <strong>Input:</strong> words = ["a",""]
|
30 | 40 | <strong>Output:</strong> [[0,1],[1,0]]
|
| 41 | +<strong>Explanation:</strong> The palindromes are ["a","a"] |
31 | 42 | </pre>
|
32 | 43 |
|
33 | 44 | <p> </p>
|
|
36 | 47 | <ul>
|
37 | 48 | <li><code>1 <= words.length <= 5000</code></li>
|
38 | 49 | <li><code>0 <= words[i].length <= 300</code></li>
|
39 |
| - <li><code>words[i]</code> consists of lower-case English letters.</li> |
| 50 | + <li><code>words[i]</code> consists of lowercase English letters.</li> |
40 | 51 | </ul>
|
41 | 52 |
|
42 | 53 | ## Solutions
|
|
0 commit comments