題目
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”,
return 1 since the palindrome partitioning [“aa”,”b”] could be produced using 1 cut.
思路
此題可以用動态規劃求解。ispal[j][i]表示字元串s的子串s[j…i]是否為回文串,cut[i]表示子串s[0…i]所需要的最小分割數
代碼
運作時間