💡🐍 Python3 | Check only the powers of 2 | 💡 Aha-moment 💡| O(n)
Intuition\nThe thing to notice with this problem is, that if there is any number that is not expressible with OR-ing, it is either a power of two, or there exis
# Intuition\nThe thing to notice with this problem is, that if there is any number that is not expressible with OR-ing, it is either a power of two, or there exists a number smaller than it, which is power of 2, and that number is also not expressible.\nThis is because of the way the "OR" works in binary, by "switching on" bits.\n\n# Approach\nCheck from smallest to larger the powers of 2 and stop when we find one that cannot be expressed.\n\n# Complexity\n- Time complexity: O(n), and we cannot possibly do better *asymptotically*, as we need to at least look at each of the numbers in `nums`.\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution:\n    def minImpossibleOR(self, nums: List[int]) -> int:\n        pows2 = [2**i for i in range(32)]\n        for pow2 in pows2:\n            if pow2 not in nums:\n                return pow2\n        # NOTE: This shouldn\'t execute, as per the problem statement\'s conditions, because nums[i] <= 10^9 < 2**30\n        return 2**32\n```\n\n# Tag\nBitwise Arithmetic, Aha-moment \uD83D\uDCA1
['Bit Manipulation', 'Python3']