Last updated 1 year ago
n, n
function missingNumbers(nums) { const set = new Set(nums); const answer = []; for (let i = 1; i <= nums.length + 2; i++) { if (set.has(i)) continue; answer.push(i); } return answer; } // Do not edit the line below. exports.missingNumbers = missingNumbers;
space optimized: n, 1