This task can be easily brought to another task of finding the length of the string minus the Longest Common subsequence of the given string and the reversed string of the given string.
In other words our answer will look like this
answer= n- LCS(s, reversed s); ////n is the length of our string
Infomration about finding LCS can be found here
No comments:
Post a Comment