#3545

Minimum Deletions for At Most K Distinct Characters

newbie · 265 · lc easy +19 · 72.9% accepted · 90 likes · top 83%

Description

Given lowercase string s and integer k, remove the fewest characters possible so that the resulting string contains at most k distinct letters.

Return the minimum deletion count.

Code

1
2
3