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.
Input: S = "banana" , T = "ban" Output: 3 Explanation: There are 3 sub-sequences: [ban], [ba n], [b an].
Input: S = "geeksforgeeks" , T = "ge" Output: 6 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).
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?Yes