Python || Explained
Intuition\nWe are only concerned about numbers in the form of 2^x.\nIf the array has [1, 2, 4, 8], then we can form every number between [2^0, (2^4)-1] by formi
# Intuition\nWe are only concerned about numbers in the form of 2^x.\nIf the array has [1, 2, 4, 8], then we can form every number between [2^0, (2^4)-1] by forming every possible representation of xxxx in binary.\n# Approach\nLet p be the minimum power such that 2^p doesn\'t exist in the array. Our answer is (2^p) = (2^0 + 2^1 + ... + 2^p-1) + 1\n\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minImpossibleOR(self, nums: List[int]) -> int:\n        vals, ans = set(nums), 0\n        for i in range(31):\n            val = 2**i\n            if val in vals:\n                ans += val\n                continue\n            return ans + 1\n```
['Python3']