I***C 发帖数: 765 | 1 我用递归做的,小的test case都过了,大的test case运行时间过长。返不回答案,
哪位做过分享一下经验吧,谢谢
---------------------
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 by deleting some (can be none) of the characters without disturbing
the relative positions of the remaining characters. (ie, "ACE" is a
subsequence of "ABCDE" while "AEC" is not).
Here is an example:
S = "rabbbit", T = "rabbit"
Return 3.
---------... 阅读全帖 |
|
I***C 发帖数: 765 | 2 我用递归做的,小的test case都过了,大的test case运行时间过长。返不回答案,
哪位做过分享一下经验吧,谢谢
---------------------
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 by deleting some (can be none) of the characters without disturbing
the relative positions of the remaining characters. (ie, "ACE" is a
subsequence of "ABCDE" while "AEC" is not).
Here is an example:
S = "rabbbit", T = "rabbit"
Return 3.
---------... 阅读全帖 |
|
m********c 发帖数: 105 | 3 不理解这个题是什么意思。。
S = "rabbbit", T = "rabbit", 为什么返回的是3?
T的subsequences可以是“r”,“a”,“ra“,”rab“,”rabit“等等,这些都在S
中,而且都不同,但为什么答案是3呢? |
|
j****y 发帖数: 684 | 4 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 by deleting some (can be none) of the characters without disturbing
the relative positions of the remaining characters. (ie, "ACE" is a
subsequence of "ABCDE" while "AEC" is not).
Here is an example:
S = "rabbbit", T = "rabbit"
Return 3.
不理解这个例子。那T里每个letter不都是一个subsequence了,而且都是S里的呀?就
算不同的,也不是3呀。 |
|
b***r 发帖数: 4186 | 5 Given a string S and a string T, count the number of distinct subsequences
of T in S.
Here is an example:
S = "rabbbit", T = "rabbit"
result is 3。
为什么结果是3呢?r, a, b, i, t不都是T得subsequence么?而且都在S里头? |
|
r*******e 发帖数: 7583 | 6 题目描述不太准确
应该说是distinct subsequences of S that equal to T
S = "rabbbit" ->
rabb it
rab bit
ra bbit
所以是3 |
|
|
s*******e 发帖数: 1630 | 8 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 by deleting some (can be none) of the characters without disturbing
the relative positions of the remaining characters. (ie, "ACE" is a
subsequence of "ABCDE" while "AEC" is not).
Here is an example:
S = "rabbbit", T = "rabbit"
Return 3.
S和T究竟什么关系?怎么得出3的? |
|
g*******i 发帖数: 110 | 9 谢谢楼上。
谁能给个例子?比如题目中提到的S = "rabbbit", T = "rabbit"
应该Return 3. 是为什么呢? |
|
T*****u 发帖数: 7103 | 10 in the example, why it is not 2, such as the subsequences of T are 'rabb'
and 'bit'
#########################################################
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 by deleting some (can be none) of the characters without disturbing
the relative positions of the remaining characters. (ie, "ACE" is a
subsequence of "ABCDE" while "AEC" is not).
Here is a... 阅读全帖 |
|
m******6 发帖数: 6262 | 11 i bought 1 silver rabbbit for $650. |
|
m***h 发帖数: 23691 | 12 do you feel rabbbit is stinky?
are |
|