Skip to content

Instantly share code, notes, and snippets.

@johndavedecano
Created October 1, 2017 07:25
Show Gist options
  • Save johndavedecano/d2213b01e88a8e424f99d03b9deb37f5 to your computer and use it in GitHub Desktop.
Save johndavedecano/d2213b01e88a8e424f99d03b9deb37f5 to your computer and use it in GitHub Desktop.
EXAMS - Missing Integer
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