Query in Positive Mex Question . problem code : MEXUM

I have seen many videos and even read editorial of this question. All the solutions are assuming that given array contains numbers from 1 to N (size of array) but it is not mentioned anywhere in the question or may be I am unable to find it.

Can someone pls tell how we can assume that array contains all elements from 1 to N with any frequency of each element.

Here is the link to the question :
CodeChef: Practical coding for everyone

Think about mex, and why elements greater than n don’t matter

1 Like

Okk, means if any one number is missing in between 1 to N then Mex will never be greater than that missing number for all subsequences containing numbers greater than that missing number. Is this the reason for this ??

I think so

1 Like

okk