Wrong answer-----

heyy in this question multiple answers are possible because in the given example. There can be two subserts of max length 5 :
10 2
1 0 0 1 0 1 0 1 0 1
1 ans- 1 0 0 1 1 1 1 1 0 1 (my answers)
2 ans- 1 0 0 1 0 1 1 1 1 1 (given output)

I guess both the answers are valid but my 3 of my test cases show wrong answers. Please clarify.

Hello @Aparna,

Yes, you have pointed out the correct ambiguity of the question.
Multiple subsets can surely be possible but not multiple answers.:wink:

What do we have to consider?
If there are multiple possibilities of substrings with max count or length, then only update the first possibility your code encounters.
In simple words, do not update for equality.

I have corrected your code:

Hope, this would help.
Give a like if you are satisfied.

1 Like

yes, i get it… thankyou :wink:

heyy , but on submission it now shows run error on two test cases

Yes @Aparna,

You will get that.
reason:
You have not satisfied the constraints.
n <= 10^5
And the size of your array is small.

yes, it worked thanks