Given an unsorted integer array, find the first missing positive integer.
For example, Given [1,2,0]
return 3
, and
[3,4,-1,1]
return 2
.
Your algorithm should run in O(n) time and uses constant
space.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
[LeetCode] [First Missing Positive 2012-03-08]