[LeetCode] Maximize the Number of Partitions After Operations

1 · · Jan. 7, 2024, 4:12 a.m.
10038. Maximize the Number of Partitions After Operations You are given a 0-indexed string s and an integer k. You are to perform the following partitioning operations until s is empty: Choose the longest prefix of s containing at most k distinct characters. Delete the prefix from s and increase the number of partitions by one. The remaining characters (if any) in s maintain their initial order. Before the operations, you are allowed to change at most one index in s to another lowercase Engli...