Prefix OR | Suffix OR | C++
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 {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        long long mul = 1<<k;\n        int n = nums.size();\n        vector<int> pre(n),suf(n);\n        pre[0] = nums[0];\n        suf[n-1] = nums[n-1];\n        for(int i = 1;i < n;i++){\n            pre[i] = nums[i] | pre[i-1];\n            suf[n-1-i] = nums[n-i-1] | suf[n-i];\n        }\n        long long ans = 0;\n        long long temp = 0;\n        for(int i = 0;i < n;i++){\n            temp = mul*nums[i];\n            if(i-1 >= 0){\n                temp = temp | pre[i-1];\n            }\n            if(i+1 < n){\n                temp = temp | suf[i+1];\n            }\n            ans = max(temp,ans);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Greedy', 'Bit Manipulation', 'Prefix Sum', 'C++']