思想:动态规划。 D[i][j] = D[i][j-1] + (T[i-1] == S[j-1] ? D[i-1][j-1] : 0);
改进后:空间复杂度 O(T.size()).
分类:
其他好文 时间:
2014-08-27 16:13:07
阅读次数:
175
这两者本质上应该没有可比性,distinct 取出唯一列,group by 是分组,但有时候在优化的时候,在没有聚合函数的时候,他们查出来的结果也一样。举例来说可能方便一点。A表id numa 1b 2c 3a 4c 7d 3e 5如果只选出id列,用distinct和group by 一样的。se...
分类:
数据库 时间:
2014-08-27 12:39:17
阅读次数:
240
Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.思路:穷举所有合法的摆法。 1 class Solut...
分类:
其他好文 时间:
2014-08-27 10:54:07
阅读次数:
206
LeetCode: Distinct SubsequencesGiven a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new...
分类:
其他好文 时间:
2014-08-26 22:53:36
阅读次数:
245
Description
a program that, given a natural number N between 0 and 4999 (inclusively), and M distinct decimal digits X1,X2..XM (at least one), finds the smallest strictly positive multiple of N that ...
分类:
其他好文 时间:
2014-08-26 21:34:06
阅读次数:
342
Sorting It All Out
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 27929
Accepted: 9655
Description
An ascending sorted sequence of distinct values is on...
分类:
其他好文 时间:
2014-08-26 19:40:46
阅读次数:
194
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
Java Solutions( Refer to blog
http://blog.csdn.net/mbh_199...
分类:
其他好文 时间:
2014-08-25 19:22:11
阅读次数:
207
??
题意 求母串中子串出现的次数(长度不超过1后面100个0 显然要用大数了)
令a为子串 b为母串 d[i][j]表示子串前i个字母在母串前j个字母中出现的次数 当a[i]==b[j]&&d[i-1][j-1]!=0时 d[i][j]=d[i-1][j-1]+d[i][j-1]
(a[i]==b[j]时 子串前i个字母在母串前j个字母中出现的次数 等于 子串前i-1个字母在母串前j...
分类:
其他好文 时间:
2014-08-25 12:00:04
阅读次数:
127
Goffi and Squary Partition
Problem Description
Recently, Goffi is interested in squary partition of integers.A set X of k distinct positive integers is called squary partition of n if and ...
分类:
其他好文 时间:
2014-08-25 11:52:45
阅读次数:
208
关于access的应用笔记20140822基本完成access数据库的搭建,并且尝试了查重,不匹配项目查找,以及上传新数据等功能,表现良好。记录一下目前研究出来的sql语句:1)去除重复项Select Distinct [字段]2)选择重复项GROUP BY 字段,字段HAVING ( ( (字段)...
分类:
数据库 时间:
2014-08-24 22:04:43
阅读次数:
277