Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

<< [34] Fewest characters to make a palindrome >>

Given a string, find the palindrome that can be made by inserting the fewest number of characters as possible anywhere in the word. If there is more than one palindrome of minimum length that can be made, return the lexicographically earliest one (the first one alphabetically).

Examples:

>>> coding_problem_34("race")
'ecarace'

>>> coding_problem_34("google")
'elgoogle'

>>> coding_problem_34("aibohphobia")
'aibohphobia'