Easy solution but hard to come up with
Intuition\nThe goal of this solution is to unset (toggle) the last consecutive set bit (the rightmost sequence of 1s) in each number of the given array using XO
# Intuition\nThe goal of this solution is to unset (toggle) the last consecutive set bit (the rightmost sequence of 1s) in each number of the given array using XOR. \n\nThe last consecutive 1 bit is the rightmost bit in a sequence of 1s. Unsetting this bit (changing it from 1 to 0) often results in the smallest possible reduction in the number\'s value, because this bit represents the smallest power of two in that sequence.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\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        for (int i = 0; i < n; i++) {\n            int num = nums[i];\n            int j = 0;\n            if(nums[i]==2){\n                ans.push_back(-1);\n                continue;\n            }\n            while (num & (1 << j)) {\n                j++;\n            }\n            num = (num ^ (1 << j-1));\n            ans.push_back(num);\n        }\n        return ans;\n    }\n};\n\n```
['C++']