42ms beats 98.87% solve by prefix and suffix
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: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        vector<int> prefix(nums.size() + 1, 0), suffix = prefix;\n        for(int i = 0;i < nums.size();i++){\n            prefix[i + 1] = prefix[i] | nums[i];\n        }\n\n        for(int i = nums.size() - 1;i >= 0;i--){\n            suffix[i] = suffix[i + 1] | nums[i]; \n        }\n\n        long long ans = 0;\n        for(int i = 0;i < nums.size();i++){\n            long long n = nums[i] * pow(2, k);\n            ans = max(ans, prefix[i] | suffix[i + 1] | n);\n        }\n\n        return ans;\n    }\n};\n\nauto init = []()\n{ \n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['Array', 'Greedy', 'Bit Manipulation', 'Suffix Array', 'Prefix Sum', 'C++']