You are given a binary string s consisting only of the characters '0' and '1'.
A substring of s is considered balanced if all '0's appear before all '1's and the number of '0's is equal to the number of '1's. An empty substring is also considered balanced.
Return the length of the longest balanced substring in s.
Constraints:
s.length
'0' s[i] '1'
You are given a binary string s consisting only of the characters '0' and '1'.
A substring of s is considered balanced if all '0's appear before all '1's and the number of '0's is equal to the number of '1's. An empty substring is also considered balanced.
Return the length of the longest balanced substring in s.
Constraints:
s.length
'0' s[i] '1'