MAXMEX - Editorial

yeah, nor they mentioned that multiple occurences are possible, I am not supposed to keep looking up in the comment section for clarification.

5 Likes

smallest positive integer which does not occur among the chosen elements

We are choosing a particular subset from the given set and checking MEX for that subset

3 Likes

Sorry, it was a typing mistake.

Even I made the same mistake :frowning:

They give two statements themselves
Editorial : MEX of a sequence is the smallest positive integer not present in the sequence.
Problem: MEX, i.e. the smallest positive integer which does not occur among the chosen elements.
These two statement are not similiar
@taran_1407

5 Likes

The answer in this case is -1.

MEX of a sequence is the smallest positive integer not present in the sequence.
So in subsequence {4,5,6,7,9,10} it will be 1 as 1 is the smallest positive number not present in the subsequence.

Please explain your approach. Did you consider multiple occurence of integers?

I think the problem statement could have been made a little more clear with 1 or 2 more input-output examples.

6 Likes

How though?

I made the same incorrect assumption and ended up solving only one question :’(

1 Like

Unless specified that array elements are unique, you ought to assume that only.

1 Like

You are right bro

MEX, i.e. the smallest positive integer which does not occur among the chosen elements

M=3
Given set = {1, 2, 4}
Acc to answer chosen set is {1, 2, 3}. So the elements which donot occur among the chosen elements are : NULL
Smallest among NULL is 3? Please explain

1 Like

When you are using the word among the elements , it signify that you are using some lower and upper bound

3 Likes

made the same assumption :pensive:

Because

Editorial : MEX of a sequence is the smallest positive integer not present in the sequence.
Problem: MEX, i.e. the smallest positive integer which does not occur among the chosen elements.

chosen elements is a subset of sequence

Yeah, but which elements you chose depends on you.

Subsequence is also a sequence. Isn’t it?

even I thought that we need to pick elements on our own from the sequence. :disappointed: and I think someone in the comments even said that it’s okay to pick it :sob:

1 Like