BITWISE BEHAVIOUR (100%) java
IntuitionConsider the binary number behaviour for a num to satisfy { ans[i] OR ans[i] + 1 = nums[i] }
CASE 1

nums[i] % 4 == 1 ie ending 01 eg 5,9,13,.. they al
# Intuition
Consider the binary number behaviour for a num to satisfy { ans[i] OR ans[i] + 1 = nums[i] }
***CASE 1***
- nums[i] % 4 == 1 ie ending 01 eg 5,9,13,.. they all ends
 & for all of them ans = nums[i]-1 , eg nums[i] = 9, then smallest possible ans = 8 (8 OR (8+1) == 9)
***CASE 2***

- nums[i] % 4 ==3 ie ending 11 ed 7,11,15,19.. 
We need to adjust by subtracting the appropriate power of 2 based on the position of trailing 1s.
Eg : nums[i] = 7 then ans[i]= 3 (7-4) 
nums[i] = 11 then ans[i] = 11-2 
nums[i] = 15 then ans[i] = 11-8 = 7 

# Approach
<!-- Describe your approach to solving the problem. -->

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

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

# Code
```java []
class Solution {
    // prims so positives
    public int getValue(int num){
        // 2 cases possible (num%4 == 1 , num%4== 3)
        if (num%4 == 1){
            return num-1;
        }
        if (num%4 == 3){
            int temp = num;
            int i=0;
            while (temp >0){
                temp /= 2;
                if(temp%2 == 0) break;
                i++;
            }
            return num - (1<<i);
        }
        return -1;
        
    }
    public int[] minBitwiseArray(List<Integer> nums) {
        int n = nums.size();
        int[] ans = new int[n];

        for (int i = 0 ; i<n ;i++){
            ans[i] = getValue(nums.get(i));
        }
        return ans;
    }
}
```
['Bit Manipulation', 'Java']