Contact: aviboots(AT)netvision.net.il
39,009 questions
50,723 answers
573 users
function findSmallestMissingNumber(arr) { const numSet = new Set(arr); let index = 1; while (true) { if (!numSet.has(index)) { return index; } index++; } } const arr = [7, 3, 2, 4, -1, 1]; console.log(findSmallestMissingNumber(arr)); /* run: 5 */