Given a string s and an integer length, find the number of unique subsequences of the given length that can be formed from the characters in s.
Explanation: Step-by-step: with input 'abcdefg', we can form only one unique subsequence of length 7, which is 'abcdefg' itself, because all characters are unique and we cannot repeat them to form another subsequence of the same length.
Explanation: Step-by-step: with input 'aaaaaaa', we can form only one unique subsequence of length 7, which is 'aaaaaaa' itself, because all characters are the same and we cannot form another subsequence of the same length with different characters.
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak