C++ Solution (Simple and easy to understand)
Intuition\n Describe your first thoughts on how to solve this problem. \nThis problem follow a specific pattern.\n# Approach\n Describe your approach to solving
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThis problem follow a specific pattern.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe pattern is to continue shifting the number until you find 0 to the right, and you must have a counter to count how much you have done this operation, then subtract 1 after shifting it to the left count - 1 times, example (1 << (count - 1) from the original number, example (11 - (1 << (count - 1)), then push this into your answer array.\n# Complexity\n- Time complexity: O(NlogK)\n> Where K is the largest number in nums.\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n> We do not need additional space to the answer array.\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans;\n\n        for (auto num : nums) {\n            int count = 0;\n\n            while ((num & (1 << count))) {\n                count++;\n            }\n\n            num == 2 ? ans.push_back(-1)\n                     : ans.push_back(num - (1 << (count - 1)));\n        }\n\n        return ans;\n    }\n};\n```
['Bit Manipulation', 'C++']