C++ solution bit manipulation
\n// Please, upvote if you like it. Thanks :-)\nvector<int> minBitwiseArray(vector<int>& nums) {\n\tint n = nums.size();\n\tvector<int> res(n, 10e8);\n\tfor (in
```\n// Please, upvote if you like it. Thanks :-)\nvector<int> minBitwiseArray(vector<int>& nums) {\n\tint n = nums.size();\n\tvector<int> res(n, 10e8);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (nums[i] & 1) {\n\t\t\tbitset<32> bs(nums[i]);\n\t\t\tfor (int j = 0; j < 31; j++) {\n\t\t\t\tauto copy = bs;\n\t\t\t\tcopy.set(j, false);\n\t\t\t\tif (((int)copy.to_ulong() | ((int)copy.to_ulong() + 1)) == nums[i])\n\t\t\t\t\tres[i] = min(res[i], (int)copy.to_ulong());\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tres[i] = -1;\n\t}\n\treturn res;\n}\n```
['Array', 'Bit Manipulation', 'C', 'Bitmask', 'C++']