Distinct subsequences
Harddynamic programmingstring
Return how many ways you can pick letters of s (keeping their order) that spell exactly t. Different chosen positions count as different ways.
Example 1
Input: s = "rabbbit", t = "rabbit" Output: 3
Example 2
Input: s = "babgbag", t = "bag" Output: 5
Constraints
- 1 ≤ s.length, t.length ≤ 60
- Lowercase letters
- The answer fits in 64 bits
Submit checks your solution against 10 tests, including hidden ones.
/**
* @param {string} s
* @param {string} t
* @return {long}
*/
function numDistinct(s, t) {
}