Medium Accuracy: 44.94%
Submissions: 21097 Points: 4
Given two strings S and T of length n and m respectively. find count of distinct occurrences of T in S as a sub-sequence.
S = "banana" , T = "ban"
Explanation: There are 3 sub-sequences:
[ban], [ba n], [b an].
S = "geeksforgeeks" , T = "ge"
Explanation: There are 6 sub-sequences:
[ge], [ ge], [g e], [g e] [g e] and [ g e].
You don't need to read input or print anything.Your task is to complete the function subsequenceCount() which takes two strings as argument S and T and returns the count of the sub-sequences modulo 109 + 7.
Expected Time Complexity: O(n*m). Expected Auxiliary Space: O(n*m).