Comments

I did the same! IDK where I am going wrong. If you get it do tell me.

Thanks, thats a nice solution. Can there be also a dp solution to it?

just untick the show unofficial checkbox at the top right corner in standings.

Can anyone explain how D can be done in O(n^2), they are checking for cnt[1] <= k and also what is the relation with the boundary elements to be 1 or 0?