Dsa
Dynamic Programming
Medium
Distinct Subsequence Count
Given two strings `s` and `t`, return the number of distinct subsequences of `t` in `s`. A subsequence is formed by deleting some characters in `s` without changing the order of the remaining characters. The input format includes two lines, the first for string s and the second for string t. Output a single integer representing the number of distinct subsequences.
Example:
Input:
rabbbit
rabbit
Output:
3
Key concepts
dynamic_programmingstringsubsequence
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now