Problem: Minimum Deletions for At Most K Distinct Characters
med
30 min
Try to solve the Minimum Deletions for At Most K Distinct Characters problem.
Statement
Given a string s and an integer k, determine the minimum number of character deletions required so that the resulting string contains at most k distinct characters.
Constraints:
1≤s.length≤16
1≤k≤16
s consists only of lowercase English letters.
Examples
Fetching Slides...
Understand the problem
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Minimum Deletions for At Most K Distinct Characters
1.
For the input string z with k=1, what is the minimum number of deletions required?
A.
0
B.
1
C.
2
D.
16
1 / 5
Figure it out!
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Sequence - Vertical
Drag and drop the cards to rearrange them in the correct sequence
1
2
3
4
5
Try it yourself
Implement your solution in the following coding playground.
Problem: Minimum Deletions for At Most K Distinct Characters
med
30 min
Try to solve the Minimum Deletions for At Most K Distinct Characters problem.
Statement
Given a string s and an integer k, determine the minimum number of character deletions required so that the resulting string contains at most k distinct characters.
Constraints:
1≤s.length≤16
1≤k≤16
s consists only of lowercase English letters.
Examples
Fetching Slides...
Understand the problem
Now, let’s take a moment to make sure you’ve correctly understood the problem. The quiz below helps you check if you’re solving the correct problem:
Minimum Deletions for At Most K Distinct Characters
1.
For the input string z with k=1, what is the minimum number of deletions required?
A.
0
B.
1
C.
2
D.
16
1 / 5
Figure it out!
We have a game for you to play. Rearrange the logical building blocks to develop a clearer understanding of how to solve this problem.
Sequence - Vertical
Drag and drop the cards to rearrange them in the correct sequence
1
2
3
4
5
Try it yourself
Implement your solution in the following coding playground.