Skip to content

Instantly share code, notes, and snippets.

@anacampesan
Created April 15, 2019 21:57
Show Gist options
  • Save anacampesan/7788ff13f7fda46dbf56183d44672acf to your computer and use it in GitHub Desktop.
Save anacampesan/7788ff13f7fda46dbf56183d44672acf to your computer and use it in GitHub Desktop.
function solution(A) {
// write your code in JavaScript (Node.js 8.9.4)
let sortedA = A.sort();
for (let i = 0; i < sortedA.length; i++) {
console.log(sortedA.indexOf(sortedA[i] + 1))
if (sortedA.indexOf(sortedA[i] + 1) === -1) {
return sortedA[i] + 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment