Lowest Positive Integer

This Question Was Asked By Stripe

There is an array of integers given. You have to find the lowest positive integer that does not exist in an array. The array can contain duplicates and negative numbers as well.

Write a function solve that have the following parameter(s):
1.) arr: an array of integer

Example
Input:
[3, 4, -1, 1]
Output:
The function will return,
2

Explanation
In an array, there are " -1, 1, 3, 4" given and the missing one is 2. So, the lowest positive integer that is missing is 2.

Constraints
• The size of the array will be greater than or equal to 1 and less than or equal to 800.
• An arr[i] will be greater than or equal to 0 and less than or equal to 1000.