Solution Review: Smallest Positive Missing Number

First solution

Using a brute force method, we check if each number exists in the list. We compare each number starting from 1 to the arrayā€™s length and check if itā€™s present in the array. The first missing number is returned. If all of the numbers are present, then -1 is returned.

Letā€™s check the illustration below to better understand the solution.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.