Missing Number
ARRAY
SORTING

Problem

Given an unsorted array nums of integers, find the smallest missing positive integer.

Ensure your solution has a time complexity of O(n) and uses constant extra space if possible.

Examples

findMissingPositive([5, 3, 1, 2]); // returns 4 // The smallest missing positive integer is 4 findMissingPositive([2, 3, 7, 6, 8, -1, -10, 15]); // returns 1
Loading...