Coding Challenge: First Missing Positive π₯π₯π₯
Published in
4 min readDec 27, 2021
Problem:
Given an unsorted integer array
nums
, return the smallest missing positive integer. You must implement an algorithm that runs inO(n)
time and uses constant extra space.
Example 1:
Input: nums = [1, 2, 0]
Output: 3
Example 2:
Input: nums = [3, 4, -1, 1]
Output: 2