紫皮书!题意:给你小写字母组成的字符串,让你划分为尽量少的回文串。思路:dp[i] 为0 - i 划分的最小的回文串的个数 则 dp[i] = min{dp[i],dp[j]+1} 如果 j+1 到 i 是回文串的话 (PS: 是 j+1 到 i 是回文串 而不是 j 到 i 是回文串)先把 从 i...
分类:
其他好文 时间:
2015-03-29 09:24:41
阅读次数:
131
1503 - A PRIMARY KEY must include all columns in the table's partitioning function错误的原因:表的主键字段必须包含分区字段。为什么?举例来说,Id为auto_increment primary key,按日期分区。考虑...
分类:
其他好文 时间:
2015-03-21 22:56:51
阅读次数:
377
Notes:1. If len dp(len+1, 0); 7 vector > rec(len, vector(len, false)); 8 for (int i = 0; i = 0; i--) {10 for (int j = i; ...
分类:
其他好文 时间:
2015-03-21 18:25:43
阅读次数:
136
1 class Solution { 2 public: 3 bool isP(string s) { 4 int start = 0, end = s.size()-1; 5 while (start > &result, vector current,...
分类:
其他好文 时间:
2015-03-21 17:02:38
阅读次数:
116
标题: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
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:
其他好文 时间:
2015-03-15 00:36:38
阅读次数:
159
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
(Version 0.0)这题的思路比较straightforward,可以看出会有overlapping的子问题,因此可以先按DP做法用一个二维数组存储对于某一substring是不是palindrome的判断,然后做backtracking时可以利用这个DP二维数组的结果来跳过重复的palind...
分类:
其他好文 时间:
2015-03-12 11:07:43
阅读次数:
158
题意:给你n个数,然后分成k部分,每一个部分的和为偶数的有p个,奇数的有k-p个,如果可以划分,输出其中的一种,不可以输出NO;思路:先输出k-p-1个奇数,再输出p-1个偶数,剩余的在进行构造。 奇数+奇数=偶数。 1 #include 2 #include 3 #include 4 #in...
分类:
其他好文 时间:
2015-03-08 22:55:51
阅读次数:
205