Solution:

We need to find the longest palindrome suffix of S.

- compute the Z function for reverse(S)$S
- find the smallest i<n such that i+Z[i] = n
- append reverse(S[1,…,i-1]) to the end of S.

Leave a reply

Solution:

We need to find the longest palindrome suffix of S.

- compute the Z function for reverse(S)$S
- find the smallest i<n such that i+Z[i] = n
- append reverse(S[1,…,i-1]) to the end of S.

%d bloggers like this: