Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

First Missing Positive Integer

You are given an array of integers. Return the smallest positive integer that is not present in the array. The array may contain duplicate entries.

For example, the input [3, 4, -1, 1] should return 2 because it is the smallest positive integer that doesn't exist in the array.

Someone tried to write a solution but didn't know python very well and wasn't sure if they got the correct solution.

Please debug to get the correct output.

print first_missing_positive([3, 4, -1, 1])
# 2