Question: Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its

 Returning back to problem solving, Gildong is now studying about palindromes.
He learned that a palindrome is a string that is the same
as its reverse. For example, strings "pop", "noon", "x", and "kkkkkk" are
palindromes, while strings "moon", "tv", and "abab" are not. An empty string

Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", and "kkkkkk" are palindromes, while strings "moon", "tv", and "abab" are not. An empty string is also a palindrome. Gildong loves this concept so much, so he wants to play with it. He has n distinct strings of equal length m. He wants to discard some of the strings (possibly none or all) and reorder the remaining strings so that the concatenation becomes a palindrome. He also wants the palindrome to be as long as possible. Please help him find one. Input The first line contains two integers n and m (1 sn

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!