1 count problem

code:https://ide.codingblocks.com/s/173533
what is wrong in my code? please help !!

hey @shashakchandel in your code you are only counting how many zeroes you can change but is not giving which is the correct subarray that is why maxlen is coming right but subarray is not,what you can do is make a window with left index WL and right index WR,start making window by fixing the WL and move WR until conditions are satisfied ones conditions failed move WL and for every window store what can be the maxlen of window satisfying the conditons.

1 Like