Easy Solution with Bit Manipulation
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nBit manipulation\n\n# C
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nBit manipulation\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N*31)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(N)\n\n# Code\n```java []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n        int ans[]= new int[nums.size()];\n        for(int i=0; i<nums.size(); i++)\n        {\n            int temp = nums.get(i);\n            if(temp == 2)\n            {\n                ans[i] = -1;\n                continue;\n            }\n            for(int j=1; j<31; j++)\n            {\n                if((temp & (1<<j))>0)\n                    continue;\n                ans[i] = temp ^ (1<<(j-1));\n                break;\n            }\n\n        }\n        return ans;\n    }\n}\n```
['Bit Manipulation', 'Java']