摘要:
给定输入字符串,要求判断任意子字符串是否对称。基本思路就是DP写出DP表达式为 dp[i][j] = dp[i + 1][j - 1] && (s[i] == s[j]) dp[i][j]代表s(i,j)的子串是否对称注意在for循环赋值时,这里增长的对象其实是子串的长度。长度为奇数时:(->... 阅读全文
摘要:
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... 阅读全文