🔥Java || Dp (tabulation)
Code\n\nclass Solution {\n    public int minInsertions(String s) {\n        String s2 = new StringBuilder(s).reverse().toString();\n        int n = s.length();\
# Code\n```\nclass Solution {\n    public int minInsertions(String s) {\n        String s2 = new StringBuilder(s).reverse().toString();\n        int n = s.length();\n        int[][] dp = new int[n+1][n+1];\n\n        for(int i = 1; i <= n; i++) {\n            for(int j = 1; j <= n; j++) {\n                if(s.charAt(i-1) == s2.charAt(j-1)) dp[i][j] = 1 + dp[i-1][j-1];\n                else dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);\n            }\n        }\n        return n - dp[n][n];\n    }\n}\n```
['Java']