c++ memoization approach without using LCS
Solution without using reverse of the string\n\nclass Solution {\npublic:\n\n     int helper(string &s, int i, int j, vector<vector<int>> & dp){\n         if(i>
Solution without using reverse of the string\n```\nclass Solution {\npublic:\n\n     int helper(string &s, int i, int j, vector<vector<int>> & dp){\n         if(i>j)return 0;\n         if(i==j)return 0;\n         if(dp[i][j]!=-1)return dp[i][j];\n         if(s[i-1]==s[j-1]){\n             return dp[i][j]=helper(s, i+1, j-1,dp);\n         }\n         else{\n             return dp[i][j]=min(1+helper(s,i+1, j,dp), 1+helper(s, i, j-1, dp));\n         }\n    }\n\n    int minInsertions(string s) {\n        int n=s.size();\n        vector<vector<int>> dp(n+1, vector<int>(n+1, 0));\n        return helper(s, 1, n, dp);\n        \n    }\n};\n```
['C++']