摘要: Question Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. F 阅读全文
posted @ 2015-11-03 11:21 树獭君 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 给定输入字符串,要求判断任意子字符串是否对称。基本思路就是DP写出DP表达式为 dp[i][j] = dp[i + 1][j - 1] && (s[i] == s[j]) dp[i][j]代表s(i,j)的子串是否对称注意在for循环赋值时,这里增长的对象其实是子串的长度。长度为奇数时:(->... 阅读全文
posted @ 2015-11-03 11:02 树獭君 阅读(270) 评论(0) 推荐(0) 编辑
摘要: QuestionGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?Solution这一题思路并不难。要满足follow-u... 阅读全文
posted @ 2015-11-03 07:49 树獭君 阅读(214) 评论(0) 推荐(0) 编辑