Missing number

2.3

3 votes
Easy-Medium
Problem

Find the smallest positive number missing from an unsorted array You are given an unsorted array with both positive and negative elements. You have to find the smallest positive number missing from the array in O(n) time. NOTE- Code can also be accepted if you take extra space, so we will manually check for this :P

Input

First line of input contains an integer N, size of the array

Second line of input contains elements of array (space separated)

Output

Smallest positive number which is missing. NOTE- '0' is not a positive number.

All the elements are in the range of int

**NOTE - Put "\n" after printing Output

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?