O(45N) simple
Make an array counting how many times each bit is in a number.\nThen simply loop through each number n and compute what would happen if we doubled it k times. \
Make an array counting how many times each bit is in a number.\nThen simply loop through each number n and compute what would happen if we doubled it k times. \nFor each bit i to count, either \n(1) B[i]>1 (will count for sure no matter what is done to n)\n(2) B[i]=1 and (1<<i)&n=0 (changing n won\'t change B[i])\n(3) B[i]=0 but (n<<k)&(1<<i), doubling n k times will make it count.\nSince n goes up to 10^9 which is less than 2^30, and k<=15, we go up to 45. \n```\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        B = [0 for _ in range(45)]\n        \n        for n in nums:\n            for i in range(30):\n\t\t\t    if (1<<i)&n: B[i]+=1\n        \n        ret = 0\n        for n in nums:            \n            Sn = 0\n            for i in range(45):\n                if B[i]>1: Sn+=(1<<i)\n                elif B[i]==1 and (1<<i)&n==0: Sn+=(1<<i)\n                elif (n<<k)&(1<<i): Sn+=(1<<i)\n                    \n            ret = max(ret,Sn)\n        return ret\n```
[]