Short C++ Memoized solution
\nclass Solution {\n    int changesToPalindrome(const string& s, int i, int j) {\n        int count = 0;\n        for(; i < j; ++i, --j)\n            if (s[i] !
```\nclass Solution {\n    int changesToPalindrome(const string& s, int i, int j) {\n        int count = 0;\n        for(; i < j; ++i, --j)\n            if (s[i] != s[j])\n                ++count;\n        return count;\n    }\n    \n    int find(const string& s, int idx, int k, vector<vector<int>>& dp) {\n        if (dp[idx][k] > -1) return dp[idx][k];\n        if (k == 1) return dp[idx][k] = changesToPalindrome(s, 0, idx);\n        int minVal = INT_MAX;\n        for (int i = idx - 1; i + 1 >= k - 1; --i)\n            minVal = min(minVal, find(s, i, k - 1, dp) + changesToPalindrome(s, i + 1, idx));\n        return dp[idx][k] = minVal;\n    }\n    \npublic:\n    int palindromePartition(string s, int k) {\n        vector<vector<int>> dp(s.size(), vector<int>(k + 1, -1));\n        return find(s, s.size() - 1, k, dp);\n    }\n};\n```
[]