You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intro
It's Maria's birthday today and Alfonso has brought a string as a gift. Maria isn't happy with the gift and comes up with a plan to exchage it. First, generate one string of size 3, and ask Alfonso to give as many coins as the number of times the string occurs as sub-sequence in Alfonso's string. Determine the number of coins Maria will get, i.e given two strings mariaString and alfonsoString, the goal is to find the count of the number of times mariaString appears as a sub-sequence in the alfonsoString. A sub-sequence is created by eliminating an number of characters from a string, from 0 to the length of the string, without changing the order of the characters retained.
for example:
mariaString = ABC
alfonsoString = ABCBABC
mariaString appears 5 times as subsqeuence in alfonsoString at 1-indexed positions (1,2,3), (1,2,7), (1,4,7), (1,6,7), and (5,6,7)
another example:
mariaString = ELO
alfonsoString = HELLOWORLD
output = 4
ELO appears as sub-sequence of HELLOWORLD at positions (2,3,5), (2,3,7), (2,4,5) and (2,4,7)
Function Description
The function should return the number of times Maria's string appears as the sub-sequence in Alfonso's string.
The text was updated successfully, but these errors were encountered:
Intro
It's Maria's birthday today and Alfonso has brought a string as a gift. Maria isn't happy with the gift and comes up with a plan to exchage it. First, generate one string of size 3, and ask Alfonso to give as many coins as the number of times the string occurs as sub-sequence in Alfonso's string. Determine the number of coins Maria will get, i.e given two strings mariaString and alfonsoString, the goal is to find the count of the number of times mariaString appears as a sub-sequence in the alfonsoString. A sub-sequence is created by eliminating an number of characters from a string, from 0 to the length of the string, without changing the order of the characters retained.
for example:
mariaString = ABC
alfonsoString = ABCBABC
mariaString appears 5 times as subsqeuence in alfonsoString at 1-indexed positions (1,2,3), (1,2,7), (1,4,7), (1,6,7), and (5,6,7)
another example:
mariaString = ELO
alfonsoString = HELLOWORLD
output = 4
ELO appears as sub-sequence of HELLOWORLD at positions (2,3,5), (2,3,7), (2,4,5) and (2,4,7)
Function Description
The function should return the number of times Maria's string appears as the sub-sequence in Alfonso's string.
The text was updated successfully, but these errors were encountered: