132. Palindrome Partitioning II

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.
public class Solution {
    public int minCut(String s) {
        int len = s.length();
        if(len == 0){
            return 0;
        }
        char sc[] = s.toCharArray();
        boolean palindrome[][] = new boolean[len][len];
        int partition[] = new int[len+1];
        partition[len] = 0;
        for(int i=len-1; i>=0; i--){
            partition[i] = len-i;
            for(int j=i; j

你可能感兴趣的:(132. Palindrome Partitioning II)