Problem 3499 · Medium

Maximize Active Section with Trade I

In a binary string, make at most one trade: turn a block of ones with zeros on both sides into zeros, then turn a block of zeros with ones on both sides into ones. Treating each end of the string as having an extra uncounted one, return the most ones achievable.

Open the interactive visualisation