leetcode题目:Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s =”aab”,
Return1since the palindrome partitioning[“aa”,”b”]could be produced using 1 cut.
Tag:动态规划
public class Solution {
/**
* 回文的最小分割数
* 1.dp[i]表示当前i到len-1这段的最小分割数
* 2.dp[i]=min{dp[j+1]+1}(i=<j<len)其中str[i..j]必须是回文、
* 3.p[i][j]=true表示str[i..j]是回文
* 4.p[i][j]=s.charAt(i)==s.charAt(j) && (j-i<2||p[i+1][j-1])
*/
public int