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"
A:
首先用最简单的方法逐个测试。 结果LTE
然后测试Rabin-Karper方法。
Mistakes:
No comments:
Post a Comment