I am currently trying the following problem.
I have some thoughts for solution but I am unable to solve it completely.
My thoughts are as follows — If we have a pattern like a*b, then if the first occurrence of 'a' in string t is at index i and the last occurrence of 'b' in string t is at index j. Then our answer will be the number of distinct subsequences of the string t(i,j). Here t(i,j) means the substring of string t from index i to index j.
But the problem is that I am unable to think of a general solution. I am also not able to find any editorials. Please help me!