leetcode 131. Palindrome Partitioning
来源:互联网 发布:画网络拓扑图 app 编辑:程序博客网 时间:2024/06/07 02:02
class Solution {public:vector<vector<string>> partition(string s){if (s.empty()){return{};}process(0, s);return res;}private:vector<vector<string>> res;vector<string> temp;void process(int start, string& s){if (start == s.size()){res.push_back(temp);return;}for (int i = start; i < s.size(); i++){if (isPalindrome(s, start, i)){temp.push_back(s.substr(start, i - start + 1));process(i + 1, s);temp.pop_back();}}}bool isPalindrome(string &s, int start, int end){while (start <= end){if (s[start++] != s[end--]){return false;}}return true;}};
0 0
- LeetCode 131. Palindrome Partitioning
- [LeetCode]131.Palindrome Partitioning
- [Leetcode] 131. Palindrome Partitioning
- [leetcode] 131.Palindrome Partitioning
- [LeetCode]131. Palindrome Partitioning
- 131. Palindrome Partitioning LeetCode
- Leetcode 131. Palindrome Partitioning
- LeetCode 131. Palindrome Partitioning
- LeetCode *** 131. Palindrome Partitioning
- LeetCode 131. Palindrome Partitioning
- LeetCode-131.Palindrome Partitioning
- 【leetcode】131. Palindrome Partitioning
- [leetcode] 131. Palindrome Partitioning
- 【Leetcode】131. Palindrome Partitioning
- [LeetCode] 131. Palindrome Partitioning
- Leetcode-131. Palindrome Partitioning
- 【LeetCode】131. Palindrome Partitioning
- Leetcode 131. Palindrome Partitioning
- 安装SQL Server提示“等待数据库引擎恢复句柄失败”
- js多继承实现
- codeforces 767 b The Queue(模拟)
- python pip源
- USB HID 设备类协议入门
- leetcode 131. Palindrome Partitioning
- 如何用photoshop把一张图片分割成几张图片呢?
- opencv学习笔记-01 显示图像
- 杨辉三角算法
- Longest Palindromic Substring-LeetCode
- 最短路上的统计
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- POJ 3578 Card Game 可能会
- UVA442书上解法 对于栈的学习