C++ solution using recursion and memoization
\nclass Solution \n{\n    public:\n    int moves(string s) //number of steps to make palindrome\n    {\n        int c=0;\n        int p1=0;\n        int p2=(int
```\nclass Solution \n{\n    public:\n    int moves(string s) //number of steps to make palindrome\n    {\n        int c=0;\n        int p1=0;\n        int p2=(int)s.length()-1;\n        while(p1<p2)\n        {\n            if(s[p1]!=s[p2]) c++;\n            p1++;\n            p2--;\n        }\n        return c;\n    }\n    int dp(vector<vector<int>>& m,string& s,int l,int k) //l is the length of the string starting from 0, k is the number of partitions\n    {\n        if(m[l][k]!=2147483647) return m[l][k];\n        if(k==1) m[l][k]=moves(s.substr(0,l));\n        else for(int i=k-1;i<l;i++) m[l][k]=min(m[l][k],dp(m,s,i,k-1)+moves(s.substr(i,l-i)));\n        return m[l][k];\n    }\n    int palindromePartition(string s, int k) \n    {\n        int n=s.length();\n        vector<vector<int>> m(n+1,vector<int>(k+1,2147483647));\n        return dp(m,s,n,k);\n    }\n};\n```
[]