Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Find the smallest positive integer that does not occur in a given sequence.
- * @param {array} A
- * @param {int} result
- */
- function solution(A) {
- const set = new Set(A);
- let i = 1;
- while(set.has(i)) {
- i++;
- }
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement