Problem 2609 · Easy

Find the Longest Balanced Substring of a Binary String

Track the current run of zeros and the ones that follow it; each one closes a balanced candidate of length 2 * min(zeros, ones).

Open the interactive visualisation