Problem in Max Mex Problem Code: MAXMEX

What should be the output of-

1
5 4
1 2 5 6 7

-1 ,as MEX of sequence < M

Yes, it should be -1, but many accepted solutions are giving output as 5

Thanks Brother, that was helpful. :slightly_smiling_face:

Not possible.

If so, test cases were weak. It is surely wrong.

Post at least one such solution to support your claim.