Leetcode 2131: Longest Palindrome by Concatenating Two Letter Words
In this problem, we want to form the longest possible palindrome by concatenating two letter words from a list:
You are given an array of strings
words
. Each element ofwords
consists of two lowercase English letters.
Create the longest possible palindrome by selecting some elements fromwords
and concatenating them in any order. Each element can be selected at most once.
Return the length of the longest palindrome that you can create. If it is impossible to create any palindrome, return0
.
A palindrome is a string…