Prefix and Suffix Array Bitwise Or -Simple and Easy O(n)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def maximumOr(self, nums: List[int], k: int) -> int:\n        if len(nums)==1:\n            return nums[0]*(2**k)\n        sufix = []\n        prefix = []\n        sufix.append(nums[0])\n        prefix.append(nums[-1])\n\n        for i in range(1,len(nums)):\n            sufix.append(sufix[-1]|nums[i])\n        \n        for i in range(len(nums)-2,-1,-1):\n            prefix.append(prefix[-1]|nums[i])\n        prefix = prefix[::-1]\n\n        n = 2**k\n        res=[]\n        for i in range(len(nums)):\n            if i == 0:\n                res.append(nums[i]*n|prefix[i+1])\n            elif i == len(nums)-1:\n                res.append(nums[i]*n|sufix[-2])\n            else:\n                res.append(nums[i]*n|sufix[i-1]|prefix[i+1])\n        return max(res)\n```
['Python', 'C++', 'Java', 'Python3']