Test case #1 failing
Hi,
But, in your code you don’t consider the right bound for the max as inclusive.
So for inputs like:
10 2
1 0 0 0 0 1 0 0 0 0
It outputs:
3
1 1 0 0 0 1 0 0 0 0
This is incorrect right? It was only able to flip one bit.
Hey @varun.saxena,
You are correct.
Doing the following willgive you correct answer:
if(i>=max_l && i<max_l+max_length)
But, this same as what you have done and it is still failing for a test case.
I am figuring it out. Why?
Soon let you know.
Sounds good thanks. Do let me know the reason when you find it out.