C++ simple concept ,complexity - O(n^2), bit , beats 100%
IntuitionApproach
starting inner loop from the nums[i]/2 because analysing showing that not any j is less than nums[i]/2 value except nums[i]==2
Complexity
Time
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
![Screenshot 2025-03-14 112812.png](https://assets.leetcode.com/users/images/fa64d6ed-7865-4b69-8d68-f70c984fdd35_1741931910.8586073.png)

# Approach
<!-- Describe your approach to solving the problem. -->
* starting inner loop from the nums[i]/2 because analysing showing that not any j is less than nums[i]/2 value except nums[i]==2 

# Complexity
- Time complexity:O(n^2)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```cpp []
class Solution {
public:
    vector<int> minBitwiseArray(vector<int>& nums) {

        int n= nums.size();
        vector<int >ans;

        for(int i=0;i<n;i++){
            for(int j=nums[i]/2;j<nums[i];j++){

                if((j|(j+1))==nums[i]){
                    ans.emplace_back(j);
                    break;
                }
            }
            if(ans.size()!=i+1){
                ans.emplace_back(-1);
            }
        }
     return ans;   
    }
};
```
['Array', 'C++']