T*****u 发帖数: 7103 | 1 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 an example:
S = "rabbbit", T = "rabbit"
Return 3. | c*****3 发帖数: 10 | 2 This question needs to be reworded like "count the number of distinct
subsequences of S that equals T".
Threre are three of them in total.
ra*bbit, rab*bit and rabb*it |
|