diff --git a/131. Palindrome Partitioning1 b/131. Palindrome Partitioning1 new file mode 100644 index 0000000..b645475 --- /dev/null +++ b/131. Palindrome Partitioning1 @@ -0,0 +1,38 @@ +class Solution { +public: + + bool ispalindrome(string s,int start,int last){ + while(start<=last){ + if(s[start++]!=s[last--]){ + return false; + } + + } + return true; + } + + void solve(vector> &ans,string s,vector &path,int idx,int n){ + + if(idx==n){ + ans.push_back(path); + return; + } + + for(int i=idx;i> partition(string s) { + vector> ans; + vector path; + int n = s.size(); + solve(ans,s,path,0,n); + return ans; + } +};