ID | Title | Difficulty | |
---|---|---|---|
Loading... |
336. Palindrome Pairs
Hard
LeetCode
Array, Hash Table, String, Trie
Problem
Given a list of unique words, return all the pairs of the distinct indices (i, j) in the given list, so that the concatenation of the two words words[i] + words[j] is a palindrome.
Example 1:
Input: words = ["abcd","dcba","lls","s","sssll"]
Output: [[0,1],[1,0],[3,2],[2,4]]
Explanation: The palindromes are ["dcbaabcd","abcddcba","slls","llssssll"]
Example 2:
Input: words = ["bat","tab","cat"]
Output: [[0,1],[1,0]]
Explanation: The palindromes are ["battab","tabbat"]
Example 3:
Input: words = ["a",""]
Output: [[0,1],[1,0]]
Code
按 <- 键看上一题!
335. Self Crossing
按 -> 键看下一题!
337. House Robber III