Problem
Ask
Submissions

Problem: Longest Palindrome by Concatenating Two-Letter Words

Medium
30 min
Explore how to identify and construct the longest palindrome from concatenated two-letter words. Learn to track relevant data efficiently and solve anagram and palindrome challenges using coding interview techniques.

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:

  • 11 \leq words.length 1000\leq 1000
  • words[i].length =2= 2
  • Each word can be used at most once.
  • words should only consist of lowercase English letters.
Problem
Ask
Submissions

Problem: Longest Palindrome by Concatenating Two-Letter Words

Medium
30 min
Explore how to identify and construct the longest palindrome from concatenated two-letter words. Learn to track relevant data efficiently and solve anagram and palindrome challenges using coding interview techniques.

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:

  • 11 \leq words.length 1000\leq 1000
  • words[i].length =2= 2
  • Each word can be used at most once.
  • words should only consist of lowercase English letters.