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.

Get hands-on with 1400+ tech skills courses.