Available question text
Given a binary string (treated with implicit '1' at both ends), you may perform at most one trade that flips an internal contiguous run of 1s (surrounded by 0s) to 0s and an internal contiguous run of 0s (surrounded by 1s) to 1s; compute the maximum number of 1s obtainable. The core challenge is to scan the run lengths and pick the pair (1-run removed, 0-run added) that maximizes the net gain in ones (n up to 1e5).
Related questions
Continue with questions that share topics or the same question type.
- Maximize Active Section with Trade II
Coding
- Active Businesses
Coding
- Active Users
Coding
- Aggregate Recent Message Events And Active Chats
Coding · Data Structure Design
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3499. Maximize Active Section with Trade I
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source