Python Elegant & Short | O(n) | Prefix Sum
Complexity\n- Time complexity: O(n)\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        n 
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n```\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        n = len(nums)\n\n        right = [0] * n\n        for i in reversed(range(n - 1)):\n            right[i] = right[i + 1] | nums[i + 1]\n\n        left = [0] * n\n        for i in range(1, n):\n            left[i] = left[i - 1] | nums[i - 1]\n\n        return max(\n            l | (num << k) | r\n            for l, num, r in zip(left, nums, right)\n        )\n```
['Prefix Sum', 'Python', 'Python3']