Created
October 1, 2017 07:25
-
-
Save johndavedecano/d2213b01e88a8e424f99d03b9deb37f5 to your computer and use it in GitHub Desktop.
EXAMS - Missing Integer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function solution(A) { | |
var min = 1; | |
A.sort(function(a,b){ | |
return a - b; | |
}); | |
for (var i in A) { | |
if (A[i] > -1 && A[i] === min) { | |
min++; | |
} | |
} | |
return min; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment