1963. Minimum Number of Swaps to Make the String Balanced
Содержание
class Solution:
def minSwaps(self, s: str) -> int:
x = 0
for c in s:
if c == "[":
x += 1
elif x:
x -= 1
return (x + 1) >> 1