simple solution || c++|| memoization || clean code || recursion
class Solution {\npublic:\n    \n    \n    vector>dp;\n    int check(string &s,int i,int j)\n    {\n        int count=0;\n        while(i<j)\n        {\n       
class Solution {\npublic:\n    \n    \n    vector<vector<int>>dp;\n    int check(string &s,int i,int j)\n    {\n        int count=0;\n        while(i<j)\n        {\n            if(s[i]!=s[j])\n            {\n                count++;\n            }\n            i++;\n            j--;\n        }\n        return count;\n    }\n    int  solve(string &s,int i,int j,int k)\n    {\n        if(k==1)\n        {\n            return check(s,i,j);\n        }\n        int  res=102;\n        if(dp[i][k]!=-1) return dp[i][k];\n        for(int ind=i;ind<j;ind++)\n        {\n            int val=check(s,i,ind);\n            int ans=val+solve(s,ind+1,j,k-1);\n            res=min(res,ans);\n        }\n        return dp[i][k]= res;\n    }\n    \n    int palindromePartition(string s, int k) {\n        \n        int n=s.size();\n        dp.resize(n,vector<int>(k+1,-1));\n        return solve(s,0,n-1,k);\n        \n    }\n};
['Recursion', 'Memoization', 'C']