41. First Missing Positive
2019-04-19
41. First Missing Positive
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
1 | Input: [1,2,0] |
Example 2:
1 | Input: [3,4,-1,1] |
Example 3:
1 | Input: [7,8,9,11,12] |
Note:
Your algorithm should run in _O_(_n_) time and uses constant extra space.
Code:
1 | class Solution(object): |