#3746
Minimum String Length After Balanced Removals
pupil · 470 · lc medium +26 · premium · 78.4% accepted · 59 likes · top 90%
Description
Given a string s of only 'a' and 'b', repeatedly remove any substring containing equal numbers of 'a' and 'b' characters until no such removal is possible; return the minimum possible length of the resulting string.
Code
1
2
3