31. First Missing Positive
Return the smallest positive integer missing from an unsorted array in O(n) time and O(1) extra space.
範例 1:
輸入: nums = [1,2,0] 輸出: 3
範例 2:
輸入: nums = [3,4,-1,1] 輸出: 2
限制條件:
1 <= nums.length <= 10^5
Return the smallest positive integer missing from an unsorted array in O(n) time and O(1) extra space.
輸入: nums = [1,2,0] 輸出: 3
輸入: nums = [3,4,-1,1] 輸出: 2
1 <= nums.length <= 10^5