Backend Engineer
Senior
programming
Given two strings s and t, return the number of distinct subsequences of s which equals t. A subsequence of a string is obtained by deleting some characters without changing the order of the remaining characters. Please implement the following function:
def numDistinct(s: str, t: str) -> int:
Constraints:
- 0 <= s.length, t.length <= 1000
- s and t consist of English letters.
Example 1:
Input: s = "rabbbit", t = "rabbit"
Output: 3
Example 2:
Input: s = "abc", t = "abc"
Output: 1
Suggested Answer