Answers for "how to convert a jumbeld string to palindrom string"

C++
1

minimum characters to make string palindrome

string s;
    int len=0,i=1;
    cin>>s;
    int n=s.size();
    vector<int> LPS(n);
    LPS[0]=0;
    while(i<n)
    {
        if(s[i]==s[len]) LPS[i++]=++len;
        else
        {
            if(len==0) LPS[i++]=0;
            else len=LPS[len-1];
        }
    }
Posted by: Guest on December-21-2021

Code answers related to "how to convert a jumbeld string to palindrom string"

Browse Popular Code Answers by Language