标题:Palindrome Partitioning通过率:26.3%难度:中等Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible pali...
分类:
其他好文 时间:
2015-03-16 16:07:04
阅读次数:
121
输入一个字符串,求出它的子串中最长的回文串。...
分类:
编程语言 时间:
2015-03-15 23:04:26
阅读次数:
165
Valid Palindrome问题:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.思路: 简单的数学推导我的代码:publi....
分类:
其他好文 时间:
2015-03-14 15:14:52
阅读次数:
82
Palindrome Partitioning问题:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partiti...
分类:
其他好文 时间:
2015-03-14 13:41:00
阅读次数:
108
(Version 0.0)这道题是在Palindrome Partitioning的基础之上要求找一个最少分割次数的partitioning,因为之前已经做过了Palindrome Partitioning,所以最开始自然想到了用DP记录所有substring是否是palindrome,然后再对每个...
分类:
其他好文 时间:
2015-03-13 07:04:57
阅读次数:
137
题目:http://blog.csdn.net/winddreams/article/details/44218961
求出每个点为中心的最长字符串,判断该串是不是从开头的回文串。
#include
#include
#include
using namespace std ;
int p[12000000] , dp[6000000];
char s[12000000]...
分类:
其他好文 时间:
2015-03-12 17:09:33
阅读次数:
103
(Version 0.0)这题的思路比较straightforward,可以看出会有overlapping的子问题,因此可以先按DP做法用一个二维数组存储对于某一substring是不是palindrome的判断,然后做backtracking时可以利用这个DP二维数组的结果来跳过重复的palind...
分类:
其他好文 时间:
2015-03-12 11:07:43
阅读次数:
158
Palindrome Number问题:Determine whether an integer is a palindrome. Do this without extra space.思路:常用的进制遍历方法while(num != 0){ remian = num % 进制; ...
分类:
其他好文 时间:
2015-03-11 12:07:14
阅读次数:
148
要注意负数不是回文,我是用上一题的解法做的。把这个数反转判断是否与原数相同。但这里也要考虑溢出的问题。注意的细节还蛮多,以后要多想下细节方面。bool isPalindrome(int x) { if(x<0) return false; long long ans = 0,cur =...
分类:
其他好文 时间:
2015-03-09 14:16:35
阅读次数:
101
Algorithm:Count the number of occurrence of each character.Only one character with odd occurrence is allowed since in a palindrome maximum number of c...
分类:
其他好文 时间:
2015-03-09 12:38:44
阅读次数:
145