https://leetcode.com/problems/first-missing-positive/ Based on this intuition, try solving on our own before looking at the code.If we have an array of length n we know "smallest missing positive integer" must be in between 1 and n+1(inclusive). For example: