Coding Challenge: First Missing Positive πŸ”₯πŸ”₯πŸ”₯

Leo N
Level Up Coding
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 in O(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

--

--

πŸŽ“ β€œA person who never made a mistake never tried anything new.” β€” Albert Einstein