131. Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",Return

[
  ["aa","b"],
  ["a","a","b"]
]
class Solution {
public:
    void DFS(string &s,vector &path,vector> &result,int start)
    {
        if(start == s.size())
        {
            result.push_back(path);
            return;
        }
        for(int i=start;i=end)
           return true;
        else
           return false;
    }

    vector> partition(string s) {
        vector> result;
        vector path;
        DFS(s,path,result,0);
        return result;
    }
};

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