###### Leetcode164: 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<string> &path, vector<vector<string>> &res)
{
if(s.size() < 1)
{
res.push_back(path);
return;
}
for(int i = 0; i < s.size(); i++)
{
int begin = 0;
int end = i;
while(begin < end)
{
if(s[begin] == s[end])
{
begin++;
end--;
}
else
break;
}
if(begin >= end)//bool isPalindrome = true;
{
path.push_back(s.substr(0,i+1));
dfs(s.substr(i+1),path,res);
path.pop_back();
}
}
}
vector<vector<string>> partition(string s) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
vector<vector<string>> res;
vector<string> path;
dfs(s,path,res);
return res;
}
};

#### leetcode之 Palindrome Partitioning I&II

2013-11-20 21:06:00

#### 【LeetCode】132. Palindrome Partitioning II 基于动态规划DP、C++、Java的分析及解法

2016-05-16 20:29:43

#### LeetCode（131）Palindrome Partitioning

2015-12-28 13:42:37

#### Palindrome Partitioning -- LeetCode

2014-04-02 08:44:17

#### Palindrome Partitioning与动态规划

2015-09-24 11:39:01

#### LeetCode 132. Palindrome Partitioning II（回文切分）

2016-05-27 00:22:56

#### LeetCode Palindrome Partitioning

2014-03-25 10:45:47

#### Palindrome Partitioning--LeetCode

2015-04-11 16:07:43

#### LeetCode131:Palindrome Partitioning

2015-07-07 17:51:57

#### Leetcode :palindrome partitioning(c++)

2017-04-14 20:05:11

## 不良信息举报

Leetcode164: Palindrome Partitioning