dp || string c++
IntuitionApproachSAME AS MINIMUM DELECTION REQUIRED TO MAKE STRING PALINDROME .FIRST CALCULATE THE LONGEST COMMAN SUBSEQUENCE OF THE STRING OF ORIGINAL AND REVE
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
SAME AS MINIMUM DELECTION REQUIRED TO MAKE STRING PALINDROME .FIRST CALCULATE THE LONGEST COMMAN SUBSEQUENCE OF THE STRING OF ORIGINAL AND REVERSED STRING BY CALCULATING LCS OF BOTH THIS STRING WE GET THE COMMON CHARS THAT ARE ON THE SAME INDEX BEFORE AND AFTER REVERSE STRING SO THIS ARE PALIDROME CHAR..LET ME EXPLAIN YOU THROUGH EXAMPLE 
S = ABCBAABA
R(S)ABAABCBA
NOW THE CHARS ARE ON SAME INDEX BEFORE AND AFTER OF REVERSE STRING ARE
ABBBA NOW YOU CAN SEE THAT **ABBA** IS A PALINDROME NOW YOUR TASK IS SIMPLE JUST REMOVE THIS ABBA LENGTH FROM S STRING WHICH IS S-LCS(ABBA)
BY SUBTRACTING WE GET NUMBER OF MORE INSERTION REQUIRED TO MAKE STRING PALINDROME BECAUSE ABBA IS ALREADY PALINDROME 
JAI SHREE RAM..HAPPY CODING

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(N²)
- Sp2ace complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(N²)
# Code
```cpp []
class Solution {
    private:
    string findLCS(string &s,string&s2,int n)
    {
        vector<vector<int>>dp(n+1,vector<int>(n+1,0));
        for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
        {
            if(s[i-1]==s2[j-1])
            dp[i][j]=1+dp[i-1][j-1];
            else
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
        //print lcs
        int i=n,j=n;
        string res;
        while(i!=0 && j!=0)
        {
            if(s[i-1]==s2[j-1])
            {
                res.push_back(s[i-1]);
                i--;
                j--;
            }
            else if(dp[i-1][j] > dp[i][j-1])
            i--;
            else
            j--;
        }
        return res;
    }
public:
    int minInsertions(string s) {
        int n=s.length();
        string s2=s;
        reverse(s2.begin(),s2.end());
        return n-findLCS(s,s2,n).length();
    }
};
```
['String', 'Dynamic Programming', 'C++']