DP:about string
来源:互联网 发布:淘宝里的地址怎么修改 编辑:程序博客网 时间:2024/05/16 18:32
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”]
]
用递归的思想求解,DP表示不会。。。。。。
相关问题:
void dfs(string s, vector<string> &path, vector<vector<string>> &result){ if(s.size() < 1) { result.push_back(path); return ; } for(int i = 0; i < s.size(); ++i) { int start = 0; int end = i; while(start < end) { if(s[start] == s[end]) { ++start; --end; } else break; } if(start >= end) { path.push_back(s.substr(0, i+1)); dfs(s.substr(i+1), path, result); path.pop_back(); } }}vector<vector<string>> partition(string s) { vector<vector<string>> result; vector<string> path; dfs(s, path, result); return result;}
阅读全文
0 0
- DP:about string
- About Search & DP
- Something about String,substring
- Java: about String
- something about deal with string
- about utf7-BOM string injection
- sth about the string function strdup
- about the character string in C language
- More about the Operations of string
- About the String Functions of XSLT
- Interview stuff about String class in java
- some functions about judge the String type
- Summarizing about:String to Int, int To string
- hdu 1075 What Are You Talking About< map<string,string> >
- HDU2476(String painter)DP
- [leetcode] Interleaving String@DP
- DP:segment string
- 【DP】Interleaving String
- Android BLE开发总结第一篇
- poj3734——矩阵快速幂入门题
- NOIP复习计划
- JavaSE基础02
- 模式的秘密---单例模式
- DP:about string
- AIDE MD主题配置
- 中国最好大学网爬取大学排名信息
- Oracle 删除表中记录 如何释放表及表空间大小
- Android LruCache : how to put and get user's data
- 学习Docker(2017-10-2)
- 《加密与解密》第三篇非明码比较分析,个人实战
- 【NOIP2016】换教室
- LinuxStudyNote(43)-图解Linux系统分区