I am finding it hard to understand your code, why are you inputting bit twice ?? whats init ?? is that checking if array[0] and array[n-1] both have 1s ?what is place function doing ??
I really didn't get the record structure as well....

This is what I am trying to do:
- I am simply using the counting of 1s to get the first position of every run there is, then I will check if there is a possible run that wraps this, then I will remove the first run saved and last run saved, because I will be combining them now.
- after this, I simply take 2 heads and 2 tails(if more than 2 runs are there)
-If there is a tail that wraps it will be >=n and i will use modulus to make it normal..I think I am getting the positions of the runs right, I am having a bit trouble in the outputting part,
here's what I am doing:

- If my counts of runs contains only 1 element, meaning only 1 streak, I will check if the 1st tail of the run is greater than n if it is %, and then I will check if current(first pointer) is lying between the streak if it is cut the streak and find max between them, and min between this and k.
- If I have more than 1 streak, I will first check if any is getting greater than n, if %, then I will check if any is being cut by the current pointer, and then I will have 3 streaks,I will get maximum and minimum between k and print it...
Still getting wrong answer tho