Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 523 Bytes

README.md

File metadata and controls

16 lines (11 loc) · 523 Bytes

<< [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'