Search
⌘K
Get Premium
Leetcode 3003. Maximize the Number of Partitions After Operations
Given a string s and integer k, you may change at most one character; then repeatedly remove the longest prefix that contains at most k distinct letters, counting each removal as a partition. Return the maximum number of partitions obtainable by choosing the optimal single-character change to maximize these greedy k-distinct-prefix splits.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.