Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, giv...
分类:
其他好文 时间:
2014-08-18 14:25:12
阅读次数:
204
题目参考自博客:http://blog.csdn.net/u011498819/article/details/38356675题意:查找这样的子回文字符串(未必连续,但是有从左向右的顺序)个数。简单的区间dp,哎,以为很神奇的东西,其实也是dp,只是参数改为区间,没做过此类型的题,想不到用dp,以...
分类:
其他好文 时间:
2014-08-18 10:36:34
阅读次数:
200
Azure HDInsightAzure HDInsight is Microsoft's distribution of Hadoop. The Azure HDInsight ecosystem includes the following features/components: Pig, H...
分类:
其他好文 时间:
2014-08-18 10:30:23
阅读次数:
477
题意:给定一个字符串,求最少添加多少个字符可使得该字符串变为回文字符串
分析:设原序列S的逆序列为S' ,最少需要补充的字母数 = 原序列S的长度 - S和S'的最长公共子串长度
原因:要求最少添加几个字符,我们可以先从原串中找到一个最长回文串,然后对于原串中不属于这个回文串的字符,在它关于回文串中心的对称位置添加一个相同字符即可。那么需要添加的字符数量即为n-最长回文串长度。
最长回文串可以看作是原串中前面和后面字符的一种匹配(每个后面的字符在前面找到一个符合位置要求的与它相同的字符)。这种的回文匹配和原...
分类:
其他好文 时间:
2014-08-15 18:02:39
阅读次数:
223
题目大意:
给你m个字符,其中有n种字符,每种字符都有两个值,分别是增加一个这样的字符的代价,删除一个这样的字符的代价,让你求将原先给出的那串字符变成回文串的最小代价。
思路分析:
状态方程:dp[i][j] 表示 区间 i-j是回文串的最小代价。
状态转移:
有三种情况。
1、 i+1 ~ j 已经是回文串了,那么对于 i 这个字符,要么删除掉,要么在这个回文串后面加一个 s...
分类:
其他好文 时间:
2014-08-15 17:55:39
阅读次数:
172
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s....
分类:
其他好文 时间:
2014-08-14 16:47:18
阅读次数:
218
本题就是求最长的回文子串。
字符串超长,不过限时却是也很长的15秒,最长的限时之一题目了,如果限时短点的话,估计能过的人不多。
使用Mancher算法是可以秒杀的。
模板式的Manacher算法:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-08-14 14:12:18
阅读次数:
139
简单题。#include #include using namespace std;int main() { int T; cin >> T; while (T--) { string s; cin >> s; int l = 0; ...
分类:
其他好文 时间:
2014-08-14 01:22:57
阅读次数:
207
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-08-14 00:59:37
阅读次数:
195
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:
其他好文 时间:
2014-08-13 12:45:46
阅读次数:
166