Skip to content

Commit 8f465a6

Browse files
committed
ReadMe.md
1 parent 0241b5d commit 8f465a6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Given an unsorted integer array nums, return the smallest missing positive integer.
2+
3+
You must implement an algorithm that runs in O(n) time and uses constant extra space.
4+
5+
6+
7+
Example 1:
8+
9+
Input: nums = [1,2,0]
10+
Output: 3
11+
Explanation: The numbers in the range [1,2] are all in the array.
12+
Example 2:
13+
14+
Input: nums = [3,4,-1,1]
15+
Output: 2
16+
Explanation: 1 is in the array but 2 is missing.
17+
Example 3:
18+
19+
Input: nums = [7,8,9,11,12]
20+
Output: 1
21+
Explanation: The smallest positive integer 1 is missing.
22+
23+
24+
Constraints:
25+
26+
1 <= nums.length <= 105
27+
-231 <= nums[i] <= 231 - 1

0 commit comments

Comments
 (0)