short and easy to understand
lps(a) = longest common subsequence (a,reverse(a))\nmin no. of deletion = len(a) - lps(a)\n\nclass Solution:\n    def minInsertions(self, s: str) -> int:\n     
lps(a) = longest common subsequence (a,reverse(a))\nmin no. of deletion = len(a) - lps(a)\n```\nclass Solution:\n    def minInsertions(self, s: str) -> int:\n        rs= s[::-1]\n        n,m = len(s),len(rs)\n        t = [[0 for j in range(m+1)]for i in range(n+1)]\n        for i in range(1,n+1):\n            for j in range(1,m+1):\n                if s[i-1] == rs[j-1]:\n                    t[i][j] = 1+t[i-1][j-1]\n                else:\n                    t[i][j] = max(t[i-1][j],t[i][j-1])      \n        return n-t[i][j]            \n```
['Dynamic Programming', 'Python']