JAVA || TABULATION || DP
\tpublic int palindromePartition(String s, int k) {\n\t\t\tint len=s.length();\n\t\t\tint[][] dp=new int[k][len];\n\t\t\tint[][] minpalin=minpalin(s);//THIS DP 
\tpublic int palindromePartition(String s, int k) {\n\t\t\tint len=s.length();\n\t\t\tint[][] dp=new int[k][len];\n\t\t\tint[][] minpalin=minpalin(s);//THIS DP HAS MEANING (MIN COST TO CHANGE (I TO J)TH STRING INTO PALINDROME)\n\n\t\t\tfor(int i=0;i<dp.length;i++){\n\t\t\t\tfor(int j=i;j<dp[0].length;j++){\n\t\t\t\t\tif(i==0){//I=0 MEANS WE NEED TO APPLY 0 CUT ON STRING\n\t\t\t\t\t\tdp[i][j]=minpalin[i][j];\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdp[i][j]=Integer.MAX_VALUE;\n\t\t\t\t\t\tfor(int l=j;l>=i;l--){\n\t\t\t\t\t\t\tdp[i][j]=Math.min(dp[i][j],dp[i-1][l-1]+minpalin[l][j]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn dp[k-1][len-1]==Integer.MAX_VALUE?0:dp[k-1][len-1];\n\t\t}\n\n\t\tpublic int[][] minpalin(String str){\n\t\t\tint len=str.length();\n\t\t\tint[][] dp=new int[len][len];\n\t\t\tfor(int gap=1;gap<len;gap++){\n\t\t\t\tint si=0;\n\t\t\t\tint ei=gap;\n\t\t\t\twhile(ei<len){\n\t\t\t\t\t if(gap==1 && str.charAt(si)!=str.charAt(ei)){\n\t\t\t\t\t\tdp[si][ei]=1;\n\t\t\t\t\t}else if(gap>1 ){\n\t\t\t\t\t\tif(str.charAt(si)==str.charAt(ei)){\n\t\t\t\t\t\t\tdp[si][ei]+=dp[si+1][ei-1];\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tdp[si][ei]+=dp[si+1][ei-1]+1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsi++;\n\t\t\t\t\tei++;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn dp;\n\t\t}
[]