JSFiddle - React, Tailwind, and code Playground

by dshilkret

JavaScript

var A = A = [1, 3, 6, 4, 1, 2];
function solution(A) {
  const set = new Set(A);
  let i = 1;

  while (set.has(i)) {
    i++;
  }

  return i;
}