C++ || DP || EASY TO UNDERSTAND
Code\n\nclass Solution {\npublic:\n    int solve(int i,int j,string &s,vector<vector<int>> &dp){\n        if(i>=j)return 0;\n        if(dp[i][j] != -1)return dp
# Code\n```\nclass Solution {\npublic:\n    int solve(int i,int j,string &s,vector<vector<int>> &dp){\n        if(i>=j)return 0;\n        if(dp[i][j] != -1)return dp[i][j];\n        if(s[i]==s[j]){\n            return dp[i][j] = solve(i+1,j-1,s,dp);\n        }else{\n            return dp[i][j] = min({solve(i+1,j,s,dp),solve(i,j-1,s,dp)})+1;\n        }\n    }\n    int minInsertions(string s) {\n        int n = s.length();\n        vector<vector<int>> dp(n,vector<int>(n,-1));\n        return solve(0,n-1,s,dp);\n    }\n};\n```
['String', 'Dynamic Programming', 'Recursion', 'Memoization', 'C++']