C++ solution
\n// Please, upvote if you like it. Thanks :-)\nlong long maximumOr(vector<int>& nums, int k) {\n\tint sz = nums.size();\n\tvector<long long> pref(sz, nums[0]),
```\n// Please, upvote if you like it. Thanks :-)\nlong long maximumOr(vector<int>& nums, int k) {\n\tint sz = nums.size();\n\tvector<long long> pref(sz, nums[0]), suff(sz, nums[sz - 1]);\n\tfor (int i = 1; i < sz; i++)\n\t\tpref[i] = pref[i - 1] | nums[i];\n\tfor (int i = sz - 2; i >= 0; i--)\n\t\tsuff[i] = suff[i + 1] | nums[i];\n\tlong long res = 0;\n\tfor (int i = 0; i < sz; i++) {\n\t\tlong long cur = nums[i], op = k;\n\t\twhile (op-- > 0)\n\t\t\tcur <<= 1;\n\t\tif (i > 0)\n\t\t\tcur |= pref[i - 1];\n\t\tif (i + 1 < sz)\n\t\t\tcur |= suff[i + 1];\n\t\tres = max(res, cur);\n\t}\n\treturn res;\n}\n```
['C', 'C++']