Find the smallest positive missing number in the given array.
Example: [0, -10, 1, 3, -20], Ans = 2
Constrains:
1<=N<=10^6
-10^6<=Ai<=1...
For further actions, you may consider blocking this person and/or reporting abuse
In JS, the solution would be filtering negative numbers and comparing to the index:
Obviously, if the positive numbers don't start at zero, we need to find out the starting number and add that as difference.
Since filter already creates a new array, there's no need to destructure it.
The only "real world application" I can think of is usually job interviews.