Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 653 Bytes

File metadata and controls

17 lines (10 loc) · 653 Bytes

Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation.

For example:

Given "aacecaaa", return "aaacecaaa".

Given "abcd", return "dcbabcd".

Credits:
Special thanks to @ifanchu for adding this problem and creating all test cases. Thanks to @Freezen for additional test cases.

Show Tags String

Show Similar Problems (M) Longest Palindromic Substring