Longest Palindrome by Concatenating Two-Letter Words
Try to solve the Longest Palindrome by Concatenating Two-Letter Words problem.
We'll cover the following
Statement
Suppose you are given an array of strings, words
, and each element in the array has a length of two. You need to return the length of the longest palindrome that can be made by concatenating some elements from words
.
If no palindrome can be made, return 0.
A palindrome is a sequence of characters that reads the same forward and backward.
Constraints:
-
words.length
words[i].length
- Each word can be used at most once.
words
should only consist of lowercase English letters.
Examples
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy