Runtime: 0ms Beats 100.00% || C++ || Java || Python3
cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans;\n\n        for(int num : nums) {\n            
```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        vector<int> ans;\n\n        for(int num : nums) {\n            int ans_i = -1;\n\n            for (int i = 0; i < num; ++i) {\n                if ((i | (i + 1)) == num) {\n                    ans_i = i;\n                    break;\n                }\n            }\n            ans.push_back(ans_i);\n        }\n        return ans;\n    }\n};\n```\n```Java []\nclass Solution {\n    public int[] minBitwiseArray(List<Integer> nums) {\n        int n = nums.size();\n        int[] ans = new int[n];\n\n        for (int i = 0; i < n; i++) {\n            int num = nums.get(i);\n            ans[i] = -1;\n\n            for (int j = 0; j < num; j++) {\n                if ((j | (j + 1)) == num) {\n                    ans[i] = j;\n                    break;\n                }\n            }\n        }\n        return ans;\n    }\n}\n```\n```Python3 []\nclass Solution:\n    def minBitwiseArray(self, nums: List[int]) -> List[int]:\n        ans = []\n\n        for num in nums:\n            ans_i = -1\n\n            for i in range(num):\n                if (i | (i + 1)) == num:\n                    ans_i = i\n                    break\n            ans.append(ans_i)\n        return ans\n```
['C++', 'Java', 'Python3']