✅  Java | Top Down DP - Memoization Approach
\n// Approach 2: Top Down DP (Memoization)\n\n// Time complexity: O(n^2)\n// Space complexity: O(n^2)\n\nclass Solution {\n    int[][] memo;\n    \n    public i
```\n// Approach 2: Top Down DP (Memoization)\n\n// Time complexity: O(n^2)\n// Space complexity: O(n^2)\n\nclass Solution {\n    int[][] memo;\n    \n    public int minInsertions(String s) {\n        int n = s.length();\n        memo = new int[n][n];\n        return lcs(s, 0, n - 1);    \n    }\n    \n    private int lcs(String s, int left, int right) {\n        if (left > right)\n            return 0;\n        \n        if (memo[left][right] != 0)\n            return memo[left][right];\n        \n        if (s.charAt(left) == s.charAt(right))\n            return memo[left][right] = lcs(s, left + 1, right - 1);\n        \n        return memo[left][right] = 1 + Math.min(lcs(s, left + 1, right), lcs(s, left, right - 1));\n    }\n}\n```\n\n**Please upvote if you find this solution useful. Happy Coding!**
['Dynamic Programming', 'Memoization', 'Java']