Problem 3399 · Hard

Smallest Substring With Identical Characters II

Binary search the longest run allowed and count the fewest flips with a dynamic program over the last character and run length.

Open the interactive visualisation