Skip to content

Instantly share code, notes, and snippets.

@MichaelWalker-git
Created October 21, 2016 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelWalker-git/af28d6eafa723c837630be0dd5899ba7 to your computer and use it in GitHub Desktop.
Save MichaelWalker-git/af28d6eafa723c837630be0dd5899ba7 to your computer and use it in GitHub Desktop.
function solution(A) {
var min = 1;
A.sort(function(a,b){
// Sort the array explicit way
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