Few lines of code
\n# Complexity\n- Time complexity:O(n)\n\n- Space complexity:O(n)\n\n# Code\ncpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& num
\n# Complexity\n- Time complexity:$$O(n)$$\n\n- Space complexity:$$O(n)$$\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans;\n        for(int&num:nums){\n            if(num==2) ans.push_back(-1);\n            else{\n                int i=0;\n                while(num&(1<<i)){\n                    i++;\n                }\n                ans.push_back(num&(~(1<<(i-1))));\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']