Search⌘ K
AI Features

Problem: First Missing Positive

Understand how to identify the smallest missing positive integer from an unsorted array by applying the cyclic sort technique. This lesson guides you through rearranging elements in place for an efficient O(n) solution with constant extra space, enhancing your grasp of array manipulation and algorithmic optimization.

Statement

Given an unsorted integer array nums, find and return the smallest positive integer that is not present in nums.

Your solution must run in O(n)O(n) time and use O(1)O(1) auxiliary space.

Constraints:

  • 1≤1 \leq ...