← Back to all problems
Hard

Distinct Subsequences

Updated Feb 24, 2026

Problem

Return number of distinct subsequences of s that equal t.

Constraints

1 <= s.length, t.length <= 1000

Examples

Example 1

Input: {"s": "rabbbit", "t": "rabbit"}
Output: 3

Function Signature

def numDistinct(self, s: str, t: str) -> int

How to Submit

Implement a Solution class with a numDistinct method.

Your method will be called with the input parameters and should return the answer.