Brute force
Intuition\n Describe your first thoughts on how to solve this problem. \nAs the constraints has limited small value used brute force\n# Approach\n Describe your
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nAs the constraints has limited small value used brute force\n# Approach\n<!-- Describe your approach to solving the problem. -->\nBrute force\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$\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=0;i<n;i++){\n            int m=nums[i];\n            if(m==2)\n               ans[i]=-1;\n            else{\n                for(int j=1;j<m;j++){\n                    if((j|(j+1))==m){\n                      ans[i]=j;\n                      break;\n                    }\n                }\n            }\n        }return ans;\n\n    }\n};\n```
['C++']