Python || Top Down DP || Commented
Time Complexiy- O(n * n * k) \nHere we can neglect time complexity of palindrome function as its also memoized and returns same value for all k\n\nclass Solutio
Time Complexiy- O(n * n * k) \nHere we can neglect time complexity of palindrome function as its also memoized and returns same value for all k\n```\nclass Solution:\n    def palindromePartition(self, s: str, t: int) -> int:\n        n=len(s)\n        @lru_cache(None)\n        def is_palin(s):                #This function returns min no of chars to change to make s as a palindrome\n            cnt=0\n            for c1,c2 in zip(s,s[::-1]):\n                if c1!=c2: cnt+=1\n            if len(s)%2==0:\n                return cnt//2\n            return (cnt+1)//2\n        @lru_cache(None)\n        def dp(i,j,k):            #We analyse string s[i:j+1] with k divisions left\n            if j==n:\n                return 0 if k==0 else sys.maxsize\n            if k==0: \n                return sys.maxsize\n            ans=sys.maxsize\n            cnt=is_palin(s[i:j+1])\n            #terminate here\n            ans=min(ans,dp(j+1,j+1,k-1)+cnt)\n            #dont terminate\n            ans=min(ans,dp(i,j+1,k))\n            return ans\n        return dp(0,0,t)\n                        \n                \n            \n```
['Dynamic Programming', 'Memoization', 'Python']