Easy C++ || Bitwise Operations || Beats 100%
Code\ncpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& a) {\n        int n = a.size();\n        vector<int> ans(n, -1);\n        
# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& a) {\n        int n = a.size();\n        vector<int> ans(n, -1);\n        for(int i=0; i<n; i++){\n            if(a[i] == 2) continue;\n            int last = -1;\n            for(int j = 0; j <=30; j++){\n                if( ((a[i]>>j) & (1)) == 0) break;\n                else last++;\n            }\n            // cout<<last<<" ";\n            ans[i] = ((a[i]^(1<<last)));\n        }\n        return ans;\n    }\n};\n\n#pragma GCC optimize("O3", "unroll-loops")\n\nauto init = [](){\n    std::ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return 0;\n}();\n```
['C++']