Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

_wannacry_'s blog

By _wannacry_, 2 months ago, In English
Astro is getting bored and want to play some interesting game. He noticed some random words written on a page of a book, and now he is wondering the maximum length of a palindrome that can be formed by concatenating any number of words.
Can you please help Astro?

Complete the 'maxConcatenatedPalindrome' function below.
The function is expected to return an INTEGER.
* The function accepts STRING ARRAY words as parameter.
Please complete the function maxConcatenatedPalindrome which takes following input:
int maxConcatenatedPalindrome (int words_count, char** words) {
words = List of strings

Integer denoting maximum length of a palindrome that can be formed by
concatenating any number of words and if no palindrome can be formed, return
Constraints
• The length of each string in words [] is at most 1000 characters.
• The number of strings in words [] is at most 1000.
•The total length of all strings in words [] does not exceed 10% characters.
• Each string in words[] can be used at most once.

Input
[words = ("ab", "ba", "xyx", "de");
Output:
7
Explanation: All possible words that are palindrome:
1. хух
2. abxyxba — by concating ab, ba, xyx
Hence the length of maximum word that can formed which is also a palindrome is 7
  • Vote: I like it
  • +2
  • Vote: I do not like it