題庫
00:00

31. First Missing Positive

困難陣列GoogleMicrosoft

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
核心程式碼模式
● 已自動儲存第 1 行,第 1 欄