Partial correct in Not All Flavours

Getting a partial correct answer on the problem Not All Flavours

My logic is pretty simple-> to use 2 pointer technique and std::set to track that segment of the array which is just less than k unique elements

please suggest a bad test case and/or the bug in the code!

Link to Code-Submission

Thanks in Advance

1 Like

1
5 3
1 2 1 3 2

1 Like

You should use map in place of set because test case like
7 3
1 2 1 2 1 3 2
you got WA

1 Like

yes, that’s absolutely correct!
Thanks!

1 Like

Its ok we are in same college.

1 Like