16. String Subsequences
Given two strings, determine the number of times
the first one appears as a subsequence in the
second one. A subsequence is created by
eliminating any number of characters from a string
(possibly 0) without changing the order of the
characters retained.
For example, let's say s1 = "ABC" and s2=
"ABCBABC". The first string appears 5 times as a
Subsequence in the second string at 1-indexed
positions of (1, 2, 3), (1, 2, 7), (1,4, 7), (1. 6, 7), and (5,
6, 7). Therefore, the answer is 5.
Function Description
Complete the function getSubsequence Count in the
editor below.
getsubsequenceCount has the following
parameters:
string s1: the first string, which always has a
length of 3
string s2: the second string
Returns:
int: the number of times sl appears as a
subsequence in s22
Constraints
length.of si- a
Answers
Answered by
1
Answer: to long to answer make it in image file
Explanation: repost it
Similar questions