Prefix OR Current_Element OR Suffix
\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        int n=nums.size();\n        vector<long long>pOR(n),sOR(n);\n        p
```\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        int n=nums.size();\n        vector<long long>pOR(n),sOR(n);\n        pOR[0]=nums[0];\n        sOR[n-1]=nums[n-1];\n        \n        for(int i=1;i<nums.size();i++)\n        {\n            pOR[i]=pOR[i-1] | nums[i];\n        }\n        \n        for(int i=n-2;i>=0;i--)\n        {\n            sOR[i]=sOR[i+1] | nums[i];\n        }\n        \n        long long ans=0;\n        int kk;\n        for(int i=0;i<n;i++)\n        {\n            kk=k;\n            long long p;\n            if(i==0) \n                p=0;\n            else \n                p=pOR[i-1];\n            \n            long long s;\n            if(i==n-1) \n                s=0;\n            else \n                s=sOR[i+1];\n            \n            long long x=nums[i];\n            while(kk--)\n            {\n                x*=2;\n            }\n            \n            long long cor=p;\n            cor = cor | x;\n            cor = cor | s;\n            ans=max(ans,cor);\n        }\n        return ans;\n        \n    }\n};\n```\n\n# ***PLS UPVOTE***
['Bit Manipulation', 'C', 'Suffix Array']