C++ brute force, beats 100% time
Intuition & ApproachCheck for a number k = 0 to nums[i] - 1 with (k | k+1) == nums[i]. Exit loop on match since we want smallest k.Complexity
Time complexity:
# Intuition & Approach

Check for a number `k` = `0` to `nums[i] - 1` with `(k | k+1) == nums[i]`. Exit loop on match since we want smallest `k`.

# Complexity

- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
vector<int> minBitwiseArray(vector<int>& nums) {
    int n = nums.size();
    vector<int> ans(n, -1);
    for (int i = 0; i < n; i++)
        for (int k = 0; k < nums[i]; k++)
            if ((k | k + 1) == nums[i]) {
                ans[i] = k;
                break;
            }
    return ans;
}
```
['C++']