C++ || O(n) || Easy & Simple
Complexity\n- Time complexity: O(n * K)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(K)\n Add your space complexity here, e.g. O(n) \n\n
# Complexity\n- Time complexity: O(n * K)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(K)\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        int n = nums.size();\n        vector<int> ans(n, 0);\n        vector<int> bits;\n        for (int i = 0; i < n; i++) {\n            if (!(nums[i] % 2)) {\n                // even no.\n                ans[i] = -1;\n                continue;\n            }\n            bits.clear();\n            while (nums[i]) {\n                bits.push_back(nums[i] % 2);\n                nums[i] /= 2;\n            }\n            bits.push_back(0);\n            for (int j = 1; j < bits.size(); j++) {\n                if (!bits[j]) {\n                    bits[j - 1] = 0;\n                    break;\n                }\n            }\n            for (int j = 0; j < bits.size(); j++) {\n                ans[i] += (bits[j] * pow(2, j));\n            }\n        }\n        return ans;\n    }\n};\n\n```
['C++']