Problem
You are given a 0-indexed array of unique stringswords.
A palindrome pair is a pair of integers (i, j) such that:
0 <= i, j < words.length,i != j, andwords[i] + words[j](the concatenation of the two strings) is a palindrome.
words.
You must write an algorithm with O(sum of words[i].length) runtime complexity.
Examples
Constraints
- 1 <= words.length <= 5000
- 0 <= words[i].length <= 300
words[i]consists of lowercase English letters.