✅C++ || DP
Code\n\nclass Solution {\npublic:\n    int minInsertions(string s) {\n        string p=s;\n        reverse(s.begin(),s.end());\n        int n=s.size();\n       
# Code\n```\nclass Solution {\npublic:\n    int minInsertions(string s) {\n        string p=s;\n        reverse(s.begin(),s.end());\n        int n=s.size();\n        vector<vector<int>>dp(n+1,vector<int>(n+1,0));\n        for(int i=1;i<=n;i++){\n            for(int j=1;j<=n;j++){\n                if(s[j-1]==p[i-1])dp[i][j]=max(dp[i-1][j],max(1+dp[i-1][j-1],dp[i][j-1]));\n                else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);\n            }\n        }\n        return n-dp[n][n];\n    }\n};\n```\n![upvote (2).jpg](https://assets.leetcode.com/users/images/32930f00-185e-4785-b9d1-4b1ecb5cb473_1681459833.037058.jpeg)\n
['Dynamic Programming', 'C++']