c++ solution
\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        int n=nums.size();\n        vector<int>ans(n,0);\n        for(int i=0
```\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        int n=nums.size();\n        vector<int>ans(n,0);\n        for(int i=0;i<n;i++){\n            int result=1e9;\n            for(int j=0;j<31;j++){\n                if(nums[i]&(1<<j)){\n                    int k=nums[i]-(1<<j);\n                    if((k|(k+1))==nums[i]){\n                        result=min(result,k);\n                    }\n                }\n            }\n            ans[i]=(result==1e9)?-1:result;\n        }\n        return ans;\n    }\n};\n```
['C', 'C++']