EASY C++ SOLUTION || BEGINNER FRIENDLY || EASY TO UNDERSTAND
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    long long maximumOr(vector<int>& nums, int k) {
        int n = nums.size();
        long long answer = 0;
        long long curr = 0;
        vector<long long>prefix(n, 0);
        vector<long long>suffix(n, 0);

        for(int i =0; i<n; i++)
        {
            curr |= nums[i];
            prefix[i] = curr;
        }
        
        curr = 0;

        for(int i=n-1; i>=0; i--)
        {
            curr |= nums[i];
            suffix[i] = curr;
        }

        for(int i=0; i<n; i++)
        {
            long long curr_val = pow(2, k);
           // cout<<curr_val<<" ";
            curr_val = nums[i]*curr_val;

            

            curr_val = curr_val | ((i-1 >= 0)? prefix[i-1]:0);
            curr_val = curr_val | ((i+1 < n)? suffix[i+1]:0);

            answer = max(answer, curr_val);
        }
        return answer;
    }
};
```
['Array', 'Greedy', 'Bit Manipulation', 'Prefix Sum', 'C++']