Thursday, December 16, 2010

Interesting problem (string based)

Find the longest prefix of a string that is a palindrome.
O(n2) is easy, but you need come up with something that's O(n).

Hint: KMP

No comments: