10ms beats 100% pure math method
Intuition\nWe only care about whether 1,2,4...2^i are in nums.\nLet\'s prove:\nIf we don\'t have 2^i, we cannot express 2^i with anyone else.\nGiven all 1,2,4..
# Intuition\nWe only care about whether $$1,2,4...2^i$$ are in nums.\nLet\'s prove:\nIf we don\'t have $$2^i$$, we cannot express $$2^i$$ with anyone else.\nGiven all $$1,2,4... 2^{i-1}$$, we can express all numbers <$$2^i$$.\nThus we only need to check $$1,2,4...$$\n\n# Complexity\nTime complexity: \n$$O(n)$$\nSpace complexity: \n$$O(n)$$\n\n# Code\n```python3 []\nclass Solution:\n    def minImpossibleOR(self, nums: List[int]) -> int:\n        nums=set(nums)\n        for i in range(31):\n            if 2**i not in nums:\n                return 2**i
['Python3']