C++ Solution
\n# Code\ncpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        for(int i = 0; i < nums.size(); i++){\n            in
\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        for(int i = 0; i < nums.size(); i++){\n            int flag = 0;\n            for(int j = 1; j < nums[i]; j++){\n                if((j | (j + 1)) == nums[i]){\n                    nums[i] = j;\n                    flag = 1;\n                    break;\n                }\n            }\n            if(!flag) nums[i] = -1;\n        }\n        return nums;\n    }\n};\n```
['C++']