cpp bitwise sol
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach : if num =2 then push -1, otherwise check the last consecutive one from th
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach : if num =2 then push -1, otherwise check the last consecutive one from the right. now if u think ki we make that one 0 and then do OR of the new number with (new no +1) as it will have one on the removed pos for sure. now their both OR will return num \n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> ans;\n\n        for(int i : nums){\n            if(i==2){\n                ans.push_back(-1);\n                continue;\n            }\n            int num = i;\n            int c = 0;\n            while(num & 1){\n                c++;\n                num /= 2;\n\n            }\n            ans.push_back(i - (pow(2,c-1)));\n        }\n        return ans;\n\n    }\n};\n```
['C++']