Easy Java Solution| Using Recursion & Dynamic Programming
Code\n\nclass Solution {\n    public int minInsertions(String s) {\n        int n= s.length();\n        int[][] dp= new int[n+1][n+1];\n        for(int[] temp: 
# Code\n```\nclass Solution {\n    public int minInsertions(String s) {\n        int n= s.length();\n        int[][] dp= new int[n+1][n+1];\n        for(int[] temp: dp){\n            Arrays.fill(temp, -1);\n        }\n        return getCount(s, 0, n-1, dp);\n    }\n\n    public int getCount(String s, int left, int right, int[][] dp){\n        if(dp[left][right] != -1){\n            return dp[left][right];\n        }\n        if(left == right){\n            return 0;\n        }\n        if(left+1 == right){\n            if(s.charAt(left) == s.charAt(right)){\n                return 0;\n            }\n            else{\n                return 1;\n            }\n        }\n        \n        if(s.charAt(left) == s.charAt(right)){\n            int ans= getCount(s, left+1, right-1, dp);\n            dp[left][right]= ans;\n            return ans;\n        }\n        else{\n            int ans1= getCount(s, left, right-1, dp);\n            int ans2= getCount(s, left+1, right, dp);\n            dp[left][right]= Math.min(ans1, ans2)+1;\n            return Math.min(ans1, ans2)+1;\n        }\n    }\n}\n```\n\n![please-upvote.jpg](https://assets.leetcode.com/users/images/4879be9f-a5ea-48fb-9b92-e07417255daf_1675598078.2915068.jpeg)\n
['String', 'Dynamic Programming', 'Recursion', 'Java']