Search
⌘K

Leetcode 1234. Replace the Substring for Balanced String

Given a string of only 'Q','W','E','R', find the minimum-length substring that can be replaced so each character appears exactly n/4 times. This reduces to finding the smallest window whose removal makes every character's count ≤ n/4, typically solved with frequency counts and a two-pointer sliding-window.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.