beating 100% c++ solution (no explanation)
\n\n# Code\ncpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n               vector<int> res;\n       for(int ele: nums) 
\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n               vector<int> res;\n       for(int ele: nums) {\n            int a = 0;\n            int temp = 0;\n\n            int count = 0;\n            while(ele!=0) {\n                if(((ele>>count)&1) == 0) {\n                    break;\n                    \n                }else{\n                    temp <<= 1;\n                    temp |= 1;\n                }\n\n                count++;\n            }\n\n            a = (ele^temp);\n            a = (a|(temp>>1));\n\n            if((a|(a+1)) == ele) {\n                res.push_back(a);\n            }else{\n                res.push_back(-1);\n            }\n       }   \n\n       return res;\n    }\n};\n```
['C++']