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-05-21 21:20:54
阅读次数:
291
判断integer是否为回文串(负数全部不为回文串)思路很直接,提取出integer中的每一位,一头一尾进行比较是否相同。一次AC
, 直接上代码:public boolean isPalindrome(int x) { if(x = 0 && x 0){ ...
分类:
其他好文 时间:
2014-05-16 00:24:44
阅读次数:
386
Determine whether an integer is a palindrome. Do this without extra space....
分类:
其他好文 时间:
2014-05-15 14:38:59
阅读次数:
278
【题目】
Determine whether an integer is a palindrome. Do this without extra space.
【题意】
题意判断一个整数是否是回文数
注意一下几点:
1. 不能用额外的空间
2. 负数不是回文数...
分类:
其他好文 时间:
2014-05-14 20:31:10
阅读次数:
298
题目一:
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
...
分类:
其他好文 时间:
2014-05-14 15:10:01
阅读次数:
293
1、
??
Valid Palindrome
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 palindrom...
分类:
其他好文 时间:
2014-05-13 07:06:35
阅读次数:
284
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Palindrome Number
Total Accepted: 12165 Total
Submissions: 41736
Determine whether an integer is a palindrome. Do this wit...
分类:
其他好文 时间:
2014-05-13 05:28:07
阅读次数:
253
1、Clone Graph
Clone an undirected graph. Each node in the graph contains a label and
a list of its neighbors.
OJ's undirected graph serialization:
Nodes are labeled uniquely.
We use # as...
分类:
其他好文 时间:
2014-05-09 02:17:58
阅读次数:
336
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1513解题报告:给定一个长度为n的字符串,在这个字符串中插入最少的字符使得这个字符串成为回文串,求这个最少的个数是多少?一开始以为只是一个普通的DP题,但是按照我的想法敲出来之后怎么样都W了,无奈搜了解题...
分类:
其他好文 时间:
2014-05-07 14:03:18
阅读次数:
293
这道题还挺复杂的,回来看了好一会儿才想起当时怎么想的。。上道题刚说不要打表,这道题就用了打表。。
总的思路是这样的,从后面往前面打表,最后一个位置的最小分割一定是0,那往前呢,如果当前考虑的位置是start,并且substr(s, i)是回文的,那么如果已知i+1开始的分割次数,那么start这个位置的分割应该就是start原来的和i+1开始的分割次数加1之间的最小值。DP的思想,很直接。
但...
分类:
其他好文 时间:
2014-05-07 07:37:39
阅读次数:
307