题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2227
Find the nondecreasing subsequences
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1...
分类:
其他好文 时间:
2014-09-12 13:34:13
阅读次数:
316
给定母串S和待匹配串T,求T能在母串S中匹配多少次(不一定要连续匹配,并且母串中多个相同字母可以依次使用,但均只能使用一次,如S=rabbbit T=rabbit, 则S中三个连续的b可以依次匹配T中两个bb各一次())...
分类:
其他好文 时间:
2014-09-11 19:31:32
阅读次数:
139
Distinct Subsequences
Given 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 string which is formed from the original string b...
分类:
其他好文 时间:
2014-09-06 22:37:44
阅读次数:
208
思想:动态规划。 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
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
??
题意 求母串中子串出现的次数(长度不超过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
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2014-08-22 21:06:19
阅读次数:
203
题目:uva10069 - Distinct Subsequences(大数+DP)
题目大意:给出字符串A , B。问能够在A中找到多少子串B,可以不连续。
解题思路:dp【i】【j】 代表从i位开始的B串在从j位开始的A串中能够找到多少种。
B【i】 == A【j】 dp【i】【j】 = dp【i - 1】【j - 1】 + dp【i】【...
分类:
其他好文 时间:
2014-08-22 12:55:38
阅读次数:
200
A classic and representative DP problem. To be revised later. Quite a few interesting details to think about.class Solution {public: int numDistinc...
分类:
其他好文 时间:
2014-08-21 13:03:34
阅读次数:
180
Given 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 string which is formed from th...
分类:
其他好文 时间:
2014-08-16 12:23:50
阅读次数:
221