# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

In a given set of integers, the “mex” or the minimum excluded value is the smallest non-negative integer that is not present in the set. For example, the mex of the set {0,1,2,4} is 3.

In this problem, you will be given a set of numbers, you will have to print the minimum excluded value of that set.

The first line of input contains an integer N, the size of the set.

The next N inputs will have one non-negative integer each, the elements of the set. Each element will appear at most once in the set.

For 10 points, N will be less than or equal to 100 and the elements will be less than or equal to 1000.

For 20 points, N will be less than or equal to 100000 and the elements will be less than or equal to 10^{5}.

For 70 points, N will be less than or equal to 100000 and the elements will be less than or equal to 10^{9}.

Output one input, the mex value of the given set.

Input | Output |
---|---|

4 0 1 2 4 | 3 |

60% Solution Ratio

BRACU_1isPrimeEarliest,

ProjectDFastest, 0.0s

ProjectDLightest, 131 kB

Jarif_RahmanShortest, 229B

Login to submit