Simple power of 2 Solution Java(O(n*32))
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n# Complexity\n- Time co
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n# Complexity\n- Time complexity:O(n*32)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n        int[] res=new int[nums.size()];\n        int k=0;\n        for(int x:nums){\n            if(x==2){\n                res[k++]=-1;\n                continue;\n            }\n            int best=x;\n            for(int i=0;i<32;i++){\n                if(((x-(1<<i))|((x-(1<<i))+1))==x){\n                    best=Math.min(x-(1<<i),best);\n                }\n            }\n            res[k++]=best;\n        }\n        return res;\n    }\n}\n```
['Java']