Maximize consecutive 1s after turning all 0s in one length-k substring into 1s.
Unlock detailed company stats for this questionUpgrade
Given a binary string log and an integer k, you can choose one substring of length k and change every 0 inside that substring to 1. Find the maximum number of consecutive 1s possible after the operation.
Example: log = "11001", k = 2 11[00]1 -> 11[11]1 Result = "11111", Answer = 5
Format · Camera- and audio-proctored OA.
Community answers
No answers contributed by the community yet.
Related questions
Find the maximum number of consecutive 1s after changing the 0s in one length-k substring to 1.Related courses

Course

Course
Course
