[LeetCode 214] Shortest Palindrome

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

Diffculty
Hard

Similar Problems
[LeetCode ] Longest Palindromic Substring Medium [LeetCode ] Implement strStr() Easy [LeetCode ] Palindrome Pairs Hard

Analysis

// http://bookshadow.com/weblog/2015/05/22/leetcode-shortest-palindrome/ // http://www.rudy-yuan.net/archives/186/

results matching ""

    No results matching ""