Python Medium
\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        \'\'\'\n        one operation, double an element\n\n        1001\n        1
```\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        \'\'\'\n        one operation, double an element\n\n        1001\n        1100\n        \n\n        \n        \'\'\'\n        lookup = defaultdict(int)\n        ans = 0\n        best = 0\n        for x in nums:\n            best |= x\n            for i in range(32):\n                if x & (1 << i):\n                    lookup[i] += 1\n        \n        # print(lookup)\n        for x in nums:\n            base = best\n\n            for i in range(32):\n                if x & (1 << i):\n                    # print(x, i)\n                    if lookup[i] == 1:\n                        base ^= (1 << i)\n\n            t = x * (2 ** k)\n\n            # print(base, x)\n           \n\n            base |= t\n            ans = max(ans, base)\n\n\n        return ans\n\n\n\n            \n\n```
['Python3']