Skip to content

Files

Latest commit

Jan 29, 2020
9dbbf68 · Jan 29, 2020

History

History
11 lines (6 loc) · 789 Bytes

README.md

File metadata and controls

11 lines (6 loc) · 789 Bytes

Daily Coding Problem: Problem #34 [MEDIUM]

Good morning! Here's your coding interview problem for today.

This problem was asked by Quora.

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).

For example, given the string "race", you should return "ecarace", since we can add three letters to it (which is the smallest amount to make a palindrome). There are seven other palindromes that can be made from "race" by adding three letters, but "ecarace" comes first alphabetically.

As another example, given the string "google", you should return "elgoogle".