这里,我介绍一下O(n)回文串处理的一种方法。Manacher算法.原文地址:http://zhuhongcheng.wordpress.com/2009/08/02/a-simple-linear-time-algorithm-for-finding-longest-palindrome-sub-...
分类:
其他好文 时间:
2014-11-26 18:38:27
阅读次数:
167
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41488377
通过本文你可能会学到的知识为:
(1)对String类中的valueOf()方法、charAt()方法、equalsIgnoreCase()方法有所了解,并知道如何使用。
(2)对Character类中的isLetterOrDigit()方法有所了解。
(3)理解解题思路,提高分析问题的能力。
注:
String类:...
分类:
其他好文 时间:
2014-11-25 23:45:17
阅读次数:
258
Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni...
分类:
其他好文 时间:
2014-11-25 22:48:55
阅读次数:
241
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs...
分类:
其他好文 时间:
2014-11-24 11:30:48
阅读次数:
161
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a pa...
分类:
其他好文 时间:
2014-11-24 10:10:28
阅读次数:
152
Determine whether an integer is a palindrome. Do this without extra space.因为都额外空间有限制所以不能把他先转成字符串然后用两个指针扫了。负数不算回文数是因为前面多了个负号么=_= 这样的话我只能想到一个办法,就是反转一个数字...
分类:
其他好文 时间:
2014-11-23 11:38:33
阅读次数:
176
Problem StatementGiven a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindr...
分类:
其他好文 时间:
2014-11-22 13:20:44
阅读次数:
301
题意:
n(10^5)个字符 光标停在第pos个字符上 光标可以左右任意移动 而且可以从最左移到最右也可以从最右移到最左 在光标处的字符可以按字母顺序或倒序更改 更改也可以a->z或者z->a 光标移动和字符更改都需要1s 问最短几s能把串变成回文的
思路:
最后的状态是一定的 因此更改的次数和策略无关 扫一遍就可以知道更改最少需要几s
光标移动需要一定的策略 容易想到...
分类:
其他好文 时间:
2014-11-21 21:56:23
阅读次数:
246
Cheapest Palindrome
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 6013
Accepted: 2933
Description
Keeping track of all the cows can be a tricky task so...
分类:
其他好文 时间:
2014-11-19 11:01:46
阅读次数:
183
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
编程语言 时间:
2014-11-19 07:08:44
阅读次数:
197