Python top-down DP solution
\n    def palindromePartition(self, s: str, k: int) -> int:\n        def recursive(i, j, k):\n            if (i, j, k) in dp:\n                return dp[(i, j, 
```\n    def palindromePartition(self, s: str, k: int) -> int:\n        def recursive(i, j, k):\n            if (i, j, k) in dp:\n                return dp[(i, j, k)]\n            if k == j - i:\n                return 0\n            if k == 1:\n                p, q = i, j - 1\n                dp[(i, j, k)] = 0\n                while p < q:\n                    if s[p] != s[q]:\n                        dp[(i, j, k)] += 1\n                    p, q = p + 1, q - 1\n                return dp[(i, j, k)]\n            dp[(i, j, k)] = float(\'inf\')\n            for p in range(i + k - 1, j):\n                dp[(i, j, k)] = min(dp[(i, j, k)], recursive(i, p, k - 1) + recursive(p, j, 1))\n            return dp[(i, j, k)]\n        \n        dp = dict()\n        return recursive(0, len(s), k)\n```
[]