1234. Replace the Substring for Balanced String
Input: s = "QWER"
Output: 0
Explanation: s is already balanced.Input: s = "QQWE"
Output: 1
Explanation: We need to replace a 'Q' to 'R', so that "RQWE" (or "QRWE") is balanced.Input: s = "QQQW"
Output: 2
Explanation: We can replace the first "QQ" to "ER". Input: s = "QQQQ"
Output: 3
Explanation: We can replace the last 3 'Q' to make s = "QWER".Last updated