Problem 214 · Hard

Shortest Palindrome

Prepend the fewest characters to make the string a palindrome using the KMP failure function.

Open the interactive visualisation