Microsoft |OA| SDE1 |help

You are given a binary string and an integer k. You can swap any 2 consecutive value in string at most k times. For ex 01 will become 10 in 1 swap. Find largest number of 1 that can be consecutive.
Sample input 10101010 and k=2
sample output=3
can someone plz help.

Comments (4)