Search
⌘K

Leetcode 2609. Find the Longest Balanced Substring of a Binary String

Find the longest contiguous substring of the form 0^k1^k (k zeroes immediately followed by k ones) — i.e., zeros before ones and equal counts — and return its length. This is equivalent to scanning adjacent runs of zeros and ones and taking the maximum 2*min(length of a zero-run, the following one-run).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.