求一个串的最大回文字串。 可以用后缀数组解决。 分别考虑奇数和偶数回文子串的情况,枚举原串S的每个位置i作为中间位置看其能向左右两边同时拓展都哪儿:把原串S反转成S',拼接SaS'(a为一个特殊字符),最远拓展的地方便可以通过LCP(suffix[i],suffix[i'])求得,i'为i对应在S‘
分类:
编程语言 时间:
2016-02-21 11:34:39
阅读次数:
276
题目描述: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a cana
分类:
编程语言 时间:
2016-02-19 00:15:07
阅读次数:
240
Palindrome Permutation I Given a string, determine if a permutation of the string could form a palindrome. For example,"code" -> False, "aab" -> True,
分类:
其他好文 时间:
2016-02-18 13:39:51
阅读次数:
181
题目描述: Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 解题思路: 使用O(n)的时间复杂度及O(1)的时间复杂
分类:
编程语言 时间:
2016-02-06 22:15:19
阅读次数:
177
Determine whether an integer is a palindrome. Do this without extra space. 题目:推断int数据是否为回文数 注意:负数不是回文数,0是最小的回文数 思路:此题和前面一道 求int数的反序差点儿相同http://blog.cs
分类:
其他好文 时间:
2016-02-03 11:40:50
阅读次数:
166
翻译给定一个单链表,确定它是否是回文的。跟进:
你可以在O(n)时间和O(1)空间下完成它吗?原文Given a singly linked list, determine if it is a palindrome.Follow up:
Could you do it in O(n) time and O(1) space?进阶bool judge(ListNode *head, ListNode...
分类:
其他好文 时间:
2016-02-02 15:13:49
阅读次数:
115
考虑溢出。思路就是用reverse integer的数学方法,把一个数倒过来,比较是否和原数字相同。特殊情况:1. 负数直接不对称2. 溢出直接不对称bug记录:记得把原数字保存一下,不然后面其实x的值已经变了 public boolean isPalindrome(int x) { ...
分类:
其他好文 时间:
2016-01-27 07:08:06
阅读次数:
170
思路1:利用Reverse Integer的方法,求的转换后的数字,然后比较是否相等。思路2:从两头依次取数字比较,向中间推进。 1 // Revert Integer解法,把反转后的和原数据对比,相同返回true 2 public static boolean isPalindro...
分类:
其他好文 时间:
2016-01-25 17:10:50
阅读次数:
124
/* Write a function to compute the maximum length palindromic sub-sequence of an array. A palindrome is a sequence which is equal to its reverse. A su...
分类:
其他好文 时间:
2016-01-25 06:38:13
阅读次数:
200
Palindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.Given a number base B (2 2 #include 3 #in.....
分类:
其他好文 时间:
2016-01-25 06:33:11
阅读次数:
181