Given a string consists of 0 and 1, you can swap any two adjacent digits of it, but you can not swap more than K times. So, what is the maximum probable length of the longest consecutive ones you can get after your swapping?
For example, assume the string is 110101001011, if you swap 3 times like this:
110101001011 --> 110011001011 --> 110011010011 --> 110011100011
The length of the longest consecutive ones is 3: 110011100011.
But if you swap 3 times like this:
110101001011 --> 111001001011 --> 111010001011 --> 111100001011
The length of the longest consecutive ones is 4: 111100001011.