Welcome to LeetCode Discuss.  Please read the FAQ to help yourself making the best use of Discuss.
Ask a Question
Back to Problem

Welcome to LeetCode Discuss.

This is a place to ask questions related to only OJ problems.

Please read the FAQ to help yourself making the best use of Discuss.

Task clarification

+2 votes
38 views

Could someone please clarify this problem to me?

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" count = 3

If I understood correctly, we need to find all distinct subsequences of T and see how many, if any appear in s. How does that equal to 3 in the given example?

asked 2 days ago in Distinct Subsequences by princessmaja (450 points)

2 Answers

0 votes
 
Best answer
I think what the questions means is try to find subsequences in S, such that the subsequence is same as T. so in S we have

ra*bbit=T
rab*bit=T
ra*bbit=T
so there're totally 3.
answered 1 day ago by jing.cs.us (460 points)
selected 1 day ago by princessmaja
+2 votes

Since you can choose two b from three and there are total of 3 choices, i.e.,

the first and the second
the first and the third
the second and the third
answered 2 days ago by porker2008 (1,810 points)

...