Palindrome Partition
来源:互联网 发布:熹妃传刷元宝软件 编辑:程序博客网 时间:2024/06/06 09:42
Given a string
Return all possible palindrome partitioningof
For example, given "aab"
,
Return
[ ["aa","b"], ["a","a","b"] ]
中心思想:递归。如果当前的string和右边的string都能被partition成palindrome,那么将这个array加到结果中去。
教训:在继续recursion的时候,一定要将当前的tmp arraylistclone,不然recursion函数将会使用同一个arraylist。这时如果是iterative方法的估计会避免。
2014.8.10 update:
错误:在储存preresult的时候,要用List而不是List>,因为每一个solution都是一个单独的List> result 中的entry
// Palindrome Partitioning
0 0
- Palindrome Partition
- LeetCode 131: Palindrome Partition
- [LeetCode] Palindrome Partition
- [LeetCode] Palindrome Partition [11]
- LeetCode: Palindrome Partition
- leetcode palindrome partition II
- palindrome partition II
- palindrome-partition-ii
- [LeetCode] 064: Palindrome Partition
- LeetCode——Palindrome Partition
- LeetCode —— Palindrome Partition II
- Two pointers (2) -- Partition List,Valid Palindrome
- Partition
- PARTITION
- partition
- partition
- partition
- Partition
- sudoku
- word search
- Restore IP address
- Queens
- surrounded region
- Palindrome Partition
- Decode Ways
- Ibizcybertech阿联酋IMS的软件服务,解决方案,今天再次拉低大型机的成本
- 关于DFS和递归的一点总结
- 【cocos2d-x官方文档】骨骼动画详解
- hd 1465 不容易系列之一
- 股票买卖
- Maximum Subarray
- Minimum path sum