Hello community!

I recently was trying to solve the following problem in which we need to tell the minimum number of bits needed to be flipped so that each window of ‘k’ size in the array(array elements are binary) has exactly odd number of ones. After trying a lot, I am not able to get the logic for the problem. Also the editorial is not given. Any help will be appreciated.

Thanks in advance!

@everule1 It would be great if you could help pls.

Problem Link

Check this in case you haven’t

I think enem’s explanation is sufficient, so my guess is you didn’t know how to implement, so here’s my commented code.

1 Like

understood now. Thanks for the effort!