JOIN
Get Time

   Problem Statement  

 Problem Statement for Palindromize

Problem Statement

    

A palindrome is a string that reads the same from left to right as it does from right to left. Given a String s, return the shortest palindrome that can be produced by adding zero or more characters to the right end of s. There is always one unique answer.

 

Definition

    
Class:Palindromize
Method:minAdds
Parameters:String
Returns:String
Method signature:String minAdds(String s)
(be sure your method is public)
    
 

Constraints

-s will contain between 1 and 50 characters, inclusive.
-Each character of s will be a lowercase letter ('a'-'z').
 

Examples

0)
    
"add"
Returns: "adda"
Add 'a' to make a palindrome. "adddda" is also a valid palindrome, but it is not the shortest possible one.
1)
    
"cigartragic"
Returns: "cigartragic"
This is already a palindrome, so the shortest solution is to add 0 letters.
2)
    
"redocpot"
Returns: "redocpotopcoder"
3)
    
"acaba"
Returns: "acabaca"
4)
    
"abczyxyz"
Returns: "abczyxyzcba"

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 335 Round 1 - Division II, Level One