C++|Most Easy Intuitive Solution
\nclass Solution {\npublic:\n    typedef long long ll;\n    long long maximumOr(vector<int>& nums, int k) {\n        int n=nums.size();\n        vector<int> pre
```\nclass Solution {\npublic:\n    typedef long long ll;\n    long long maximumOr(vector<int>& nums, int k) {\n        int n=nums.size();\n        vector<int> pref(n,0);\n        vector<int> suff(n,0);\n        pref[0]=nums[0];\n        suff[n-1]=nums[n-1];\n        for(int i=1;i<n;i++)\n            pref[i]=pref[i-1]|nums[i];\n        for(int i=n-2;i>=0;i--)\n            suff[i]=suff[i+1]|nums[i];\n        long long ans=LONG_MIN;\n        if(n==1)\n        {\n            while(k--)\n                nums[0]=nums[0]<<1;\n            return nums[0];\n        }\n        ll z1=nums[0];\n        ll x1=k;\n        while(x1--)\n            z1=z1<<1;\n        ans=max(ans,z1|suff[1]);\n        ll z2=nums[n-1];\n        ll x2=k;\n        while(x2--)\n            z2=z2<<1;\n        ans=max(ans,z2|pref[n-2]);\n        for(int i=1;i<n-1;i++)\n        {\n            long long x=k,z=nums[i];\n            while(x--)\n            z=z<<1;\n            ans=max(ans,pref[i-1]|z|suff[i+1]);\n        }\n        return ans;\n    }\n};\n```
[]