Why won't the frequency of letters work. Why will LCS work.
\ndef minInsertions(self, s: str) -> int:\n        if s == s[::-1] or len(s)==1:\n            return 0\n        t = s[::-1]\n        dp = [[0]*(len(s)+1) for _ 
```\ndef minInsertions(self, s: str) -> int:\n        if s == s[::-1] or len(s)==1:\n            return 0\n        t = s[::-1]\n        dp = [[0]*(len(s)+1) for _ in range(len(t)+1)]\n        for i in range(1,len(s)+1):\n            for j in range(1,len(t)+1):\n                if s[i-1]==t[j-1]:\n                    dp[i][j] = 1+dp[i-1][j-1]\n                else:\n                    dp[i][j] = max(dp[i-1][j],dp[i][j-1])\n        # print(dp)\n        return len(s)-dp[-1][-1]\n```\nAs a noob the first solution that came to my mind was counting the frequency of letters as the minimum requirement to have a string as palindrome is every letter should have even frequency except one. One letter is allowed to have an odd frequency. \nex: **MEMEM**\nIt is a palindrome with E : 2 and M:3. \n Now why wont the capturing of just freq won\'t work? \n It is because in this question we are concerned with the positioning of the letters as well while in freqency capturing technique, we are concerned with any permutation of string which would turn into a plindrome by least insertions.\n EX:\n Lets see a string : "ZJVEIIWVC"\n the freq table will look like this: \n {\n Z:1,\n E:1\n J:1,\n V:2\n I:2\n W:1\n C:1\n }\n So if we just choose any 4 letters among (E,Z,J,W,C) our minimum insertion will be 4 but only one of the permutation of resultant string will be palindrome. \nResultant string can be : Z E W C V I J I V C W E Z\n\nBut with LCS we can find the least insertion we need to do to make the given string a palindrome and not any of its permutations.\n\n**Thanks and Please do let me know if you need any further clarifications**
['Dynamic Programming', 'Python', 'Python3']