[JavaScript] 2568. Minimum Impossible OR
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nif 1 is there\nif 10 is there\nthen we can always generate 11\n\nsimilarl
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nif 1 is there\nif 10 is there\nthen we can always generate 11\n\nsimilarly\nif 100 is also there\nthen we can always generate 101, 110 & 111\n\nso if 2 power i is missing, that is the our number we cannot generate\n\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n\n1 - 32 bit from constraints\n```\nvar minImpossibleOR = function (a) {\n    let set = new Set(a);\n\n    for (let i = 0; i < 32; i++)\n        if (!set.has(1 << i)) {\n            return 1 << i;\n        }\n\n    return -1;\n};\n```\n\n2\n```\nvar minImpossibleOR = function (a) {\n    let set = new Set(a);\n\n    let two_pow = 1;\n    while (set.has(two_pow)) {\n        two_pow *= 2;\n    }\n\n    return two_pow;\n};\n```\n
['JavaScript']