Prefix Suffix OR || Super Simple || C++
Code\n\nclass Solution \n{\npublic:\n    long long maximumOr(vector<int>& nums, int k) \n    {\n        long long n=nums.size();\n        vector<long long> prex
# Code\n```\nclass Solution \n{\npublic:\n    long long maximumOr(vector<int>& nums, int k) \n    {\n        long long n=nums.size();\n        vector<long long> prexor(n,0), sufxor(n,0);\n        prexor[0]=nums[0];\n        for(long long x=1; x<nums.size(); x++)\n        {\n            prexor[x]=(prexor[x-1]|nums[x]);\n        }\n        sufxor[n-1]=nums[n-1];\n        for(long long x=n-2; x>=0; x--)\n        {\n            sufxor[x]=(sufxor[x+1]|nums[x]);\n        }\n        long long p=pow(2,k);\n        long long ans=0;\n        for(long long x=0; x<n; x++)\n        {\n            long long o=nums[x]*p;\n            if(x>0) o|=prexor[x-1];\n            if(x<n-1) o|=sufxor[x+1];\n            ans=max(ans,o);\n        }\n        return ans;\n    }\n};\n```
['Bit Manipulation', 'Prefix Sum', 'C++']