C++ | Beats 100% | T.C. O (N * 32), S.C. O (1)
\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans;\n        \n        for(int i=0;i<nums.size(); i++){\
```\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans;\n        \n        for(int i=0;i<nums.size(); i++){\n            \n            if(nums[i]==2){\n                ans.push_back(-1);\n                continue;\n            }\n            \n            int last_bit_pos = -1;\n            \n            for(int j=0; j<31; j++){\n                if(nums[i] & (1<<j))\n                    last_bit_pos = j;\n                \n                else break;\n            }\n            \n            int mask = 1<<last_bit_pos;\n            \n            mask = ~mask;\n            \n            ans.push_back(nums[i]&mask);\n            \n        }\n        \n        return ans;\n        \n    }\n};\n```
['Bit Manipulation', 'C']