1 Count Problem using Deque

My code https://ide.codingblocks.com/s/73197 is not passing the test cases. Can you please explain where it is going wrong ?

In the sample test cases, there can be two possible correct outputs (due to the alternating zeros and ones). My code gives the other output than that mentioned in there. I hope that isn’t causing any problems ?

I have changed my code https://ide.codingblocks.com/s/73197
Only 1 test case is not passing, rest 4 are giving correct answer.
Could you please point out the edge case I am missing out ?

I have tried using vector also instead of bitset https://ide.codingblocks.com/s/73705 but still the same problem exactly.
Please help

Hi

@sanjeetboora not able to view this question on my portal. please see to this.

@S18LPC-OL0076 have you asked this through ask doubts?

I have asked through the discuss.codingblocks website
This is the Question -
1 COUNT
Given an array of size n with 0s and 1s , flip at most k 0s to get the longest possible subarray of 1s.

Input Format:
First Line : n, size of array and k Second Line : n space separated numbers (0s or 1s)

Constraints:
n <= 10^5 0 <= k <= n

Output Format
First Line : Size of subarray Second Line : Array after flipping k 0s

Sample Input
10 2
1 0 0 1 0 1 0 1 0 1
Sample Output
5
1 0 0 1 1 1 1 1 0 1

can you ask this through ask doubt in your online course?
I will be able to help you effectively, i hope you understand it.

I had tried using that way, but I am not able to post as it shows “Doubt Support Period ended”
thats Why I had to post all my doubts on this webiste

@tusharsk Can you please point out the edge case I am missing out ?
Or at least please provide some hint.