3399. Smallest Substring With Identical Characters II
You are given a binary string
s
of lengthn
and an integernumOps
.You are allowed to perform the following operation on
s
at mostnumOps
times:
- Select any index
i
(where0 <= i < n
) and flips[i]
. Ifs[i] == '1'
, changes[i]
to'0'
and vice versa.You need to minimize the length of the longest substring of
s
such that all the characters in the substring are identical.Return the minimum length after the operations.
A substring is a contiguous non-empty sequence of characters within a string.
c++
1 | class Solution { |