Bit-operation, Easy Solution
The key observation is that you should apply all the operations to any one of the element.\nWhy?  Any 2^i is greater than the sum of all 2^(0 to i-1)\nor (2^i> 
The key observation is that you should apply all the operations to any one of the element.\nWhy?  Any 2^i is greater than the sum of all 2^(0 to i-1)\nor (2^i> 2^(i-1)+2^(i-2).....+ 2^0), \nso we will multiply any number k times, so that we get the highest set bit and thus the highest sum.\n\nSolution- We will check for every index by applying all the k operations at that index and then find the max resultant OR.\n\nTime Complexity: O(N * 50)\nSpace Complexity: O(50)\n\n```\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        long long ans=0;\n        vector<int> bit(50,0);\n        for(auto x:nums) {\n            for(int i=0;i<31;i++) {\n                if(x&(1<<i)) \n                    bit[i]++;\n            }\n        }\n        for(auto x:nums) {\n            vector<int> temp=bit;\n            for(int i=0;i<31;i++) {\n                if(x&(1<<i)) \n                    temp[i+k]++,temp[i]--;\n            }\n            long long num=0;\n            for(auto i=0;i<50;i++) \n                if(temp[i]) num+=(1LL<<i);\n            if(num>ans) ans=num;\n        }\n        return ans;\n        \n    }\n};\n```\nHappy Coding
['Bit Manipulation', 'C']