Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 530 Bytes

File metadata and controls

13 lines (9 loc) · 530 Bytes

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