Python | Prefix | Suffix
I checked several solutions and created my own to see if I understood them correctly.\nThe idea is here to find number with the highest bit_length and save the 
I checked several solutions and created my own to see if I understood them correctly.\nThe idea is here to find number with the highest `bit_length` and save the value at `max_bit` and numbers at `max_bit_list`. Meanwhile also find bitwise OR for all other numbers ans keep them in `ans`.\nBecuase we want the maximum bitwise OR we want to shift left numbers `k` times. Thus we shift every numbers from `max_bit_list` and keep total maximum of OR operation.\n\n```\nfrom operator import ior\n\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        \n        max_bit = 0\n        max_bit_list = []\n        ans = 0\n        for n in nums:\n            n_bits = n.bit_length()\n            if n_bits > max_bit:\n                max_bit_list.append(ans)\n                ans = reduce(ior, max_bit_list)\n                max_bit_list = [n,]\n                max_bit = n_bits\n            elif n_bits == max_bit:\n                max_bit_list.append(n)\n            else:\n                ans |= n\n        \n        prefix = [0] * (len(max_bit_list))\n        suffix = [0] * (len(max_bit_list))\n        \n        for i in range(1, len(max_bit_list)):\n            prefix[i] = prefix[i - 1] | max_bit_list[i - 1]\n        \n        for i in range(len(max_bit_list) - 1, 0, -1):\n            suffix[i - 1] = suffix[i] | max_bit_list[i]\n\n        ans2 = 0\n        \n        for i in range(len(max_bit_list)):\n            ans2 = max(ans2, ans | prefix[i] | max_bit_list[i] << k | suffix[i])\n            \n        return ans2\n```
['Python']