Bitwise Greedy
Code\ncpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        int n = nums.size();\n        vector<int>ans(n,-1);\n    
# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        int n = nums.size();\n        vector<int>ans(n,-1);\n        for(int i=0;i<n;i++){\n            if(nums[i]==2) ans[i]=-1;\n            else {\n                int j=1;\n                while(j<32 && ((1<<j)&nums[i])) j++;\n                ans[i] = nums[i]^(1<<(j-1));\n            }\n        }\n        return ans;\n    }\n};\n```
['Greedy', 'Bit Manipulation', 'C++']