Given a linked list and a value x, partition it such that all nodes less than
x come before nodes greater than or equal to x.
You should preserve the original relative order of the nodes in each of ...
分类:
其他好文 时间:
2014-08-01 13:45:32
阅读次数:
163
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2014-08-01 12:49:41
阅读次数:
186
题目:Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For exam....
分类:
编程语言 时间:
2014-08-01 10:30:01
阅读次数:
218
PartitionTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 842Accepted Submission(s): 478 Problem...
分类:
其他好文 时间:
2014-08-01 10:29:51
阅读次数:
261
题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: ....
分类:
编程语言 时间:
2014-08-01 10:27:11
阅读次数:
310
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi...
分类:
其他好文 时间:
2014-08-01 04:40:11
阅读次数:
166
E -Palindromic NumbersTime Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %lluDescriptionA palindromic number or numeral palindrome is a 'symm...
分类:
其他好文 时间:
2014-07-31 23:36:50
阅读次数:
360
和快速排序有点类似,利用快速排序的划分算法,
划分算法见http://blog.csdn.net/buyingfei8888/article/details/8997803
根据int partition(int number[],int start,int end);返回值为数组下标,大小为index,index左边值均小于number【index】,右边均大于number【index】,若...
分类:
其他好文 时间:
2014-07-31 17:05:16
阅读次数:
191
题目就是给一个字符串问最少插入多少个字符能让原字符串变为回文字符串。算法:用原串的长度减去原串与翻转后的串的最大公共字串的长度,就是所求答案。 1 //#define LOCAL 2 #include 3 #include 4 #include 5 #include 6 using name...
分类:
其他好文 时间:
2014-07-31 12:24:36
阅读次数:
220
Manacher算法是个解决Palindrome问题的O(n)算法,可以说是个超级算法了,秒杀其他一切Palindrome解决方案,包括复杂的后缀数组。
网上很多解释,这里总结一下思想重点:
1 原字符串的字符间插入新的字符, 如#,方便统一所有的字符中心,比如aa和aba的字符中心不一样的,aa的字符中心可以说是aa,而aba的中心则是b,而插入#之后,aa成#a#a#,其中...
分类:
其他好文 时间:
2014-07-31 03:04:15
阅读次数:
224