<p>Given a string <em>s</em>, partition <em>s</em> such that every substring of the partition is a palindrome. </p><p>Return the minimum cuts needed for a palindrome partitioning of <em>s</em>. </p><p>For example, given <em>s</em> ="aab",
Return1since the palindrome partitioning["aa","b"]could be produced using 1 cut. </p>
int minCut(string s)
{
int n = s.size();
vector<int>vec(n+1);
for(int i = 0;i<n+1;++i)
{
vec[i] = i-1;
}
vector<vector<bool>>p(n, vector<bool>(n,false));
for(int i = 0;i<n;++i)
{
for(int j = 0;j<=i;++j)
{
if(s[i] == s[j] && (i-j < 2 || p[j+1][i-1]))
{
p[j][i] = true;
vec[i+1] = min(vec[i+1],vec[j] + 1);
}
}
}
return vec[n];
}