tiles: each uppercase English letter stands for one color.
You may repaint at most repaints tiles, each in any of the 26 colors. Return the greatest length of a run of consecutive tiles of a single color that you can get after repainting.tiles="RRGRBRR", repaints=1 → 4
Repaint the G red to get RRRRBRR: the first four tiles now share one color.
tiles="ABCD", repaints=0 → 1
No repaints are allowed, and no two neighboring tiles match.
tiles="XYXY", repaints=2 → 4
Repaint both Y tiles to X and the whole path is one color.
tiles) ≤ 10⁵repaints ≤ len(tiles)tiles consists of uppercase English letterstiles="RRGRBRR", repaints=1
4
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.