Prefix - Suffix with intuitiion -> why to increase only one element why not spread it.
Intuition\n1. or operation\n2. k is very small\n3. multiply with 2 -> left shifting\n\ncorrect statement multiplying the number with left most msb is most benif
# Intuition\n1. or operation\n2. k is very small\n3. multiply with 2 -> left shifting\n\ncorrect statement multiplying the number with left most msb is most benificial as it will make the or more bigger as it has MSB at.\n\nnow there can be multiple numbers with left most msbs. We have to choose one of them. \nWhich one will be best option to choose ?\n- the one which after choosing if done an OR with rest of the numbers will give max OR result / will have lesser \nimposition of bits\n\nwhy not spread k accross multiple numbers with left most msb? \n- even if we do k-1 with a number and 1 with another then we are reducing the or potentially by 2^k.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        int n = nums.size();\n\n        vector<long long> prefixOr(n, 0), suffixOr(n, 0);\n\n        for (int i = 1; i < n; i++) {\n            prefixOr[i] = (prefixOr[i-1]|nums[i-1]);\n        } \n\n        for (int i = n-2; i >= 0; i--) {\n            suffixOr[i] = (suffixOr[i+1]|nums[i+1]);\n        }\n\n        long long p = pow(2,k);\n        long long ans = 0;\n        for (int i = 0; i < n; i++) {\n            ans = max(ans, (prefixOr[i]|suffixOr[i])|(nums[i]*p));\n        }\n\n        return ans;\n    }\n};\n```
['C++']