# First Missing Positive

Ask: is the array sorted? (cus it might have multiple missing numbers, but no matter what the first index is, the first one *satisfy (nums.index(i) === -1) will be the one missing).. I don’t really get why this one is hard..there must be a trap somewhere i am not realizing….(come back later)*

input is an array of numbers,

To find the first missing positive integers from 1- n

e.g. input: [3,4 ,5, 6] output: 1

e.g. input: [1, 3,4 ,5, 6] output: 2

e.g. input: [1, 2,3 ,4] output: 5

I can compare the input with [1, 2, .. n], (where n is arr.length) the first missing number will be the output

time: O(n)

space: O(1)