Bits Count Vector | C++ | Simple
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long maximumOr(vector<int>& nums, int k) {\n        long long ans = 0;\n        vector<int> bits(48, 0); // 32 + 15(max k)\n        for(int i = 0; i < nums.size(); i++)\n        {\n            int ele = nums[i];\n            for(int j = 0; j < 32; j++)\n            {\n                if((ele >> j)&1)\n                    bits[47 - j]++;\n            }\n        }\n        for(int i = 0; i < nums.size(); i++)\n        {\n            int ele = nums[i];\n            vector<int> b(bits);\n            // As all K operations should optimally be applied on same element for maximum or , in bits it translates to just moving k bit positions forward to apply multiplication of 2 , k times \n            for(int j = 0; j < 32; j++)\n            {\n                if((ele >> j)&1)\n                {\n                    b[47 - j]--;\n                    b[47 - j - k]++;\n                }\n            }\n            string str = "";\n            for(auto x: b)\n                str += (x > 0 ? \'1\':\'0\');\n            long long temp = stoll(str, 0, 2);\n            ans = max(ans, temp);\n        }\n        return ans;\n    }\n};\n```
['Bit Manipulation', 'C++']