converting the first '1' before the first '0'
IntuitionBy analyzing the examples provided, you can notice a pattern: converting the first '1' before the first '0' gives you the answer.Code
# Intuition
By analyzing the examples provided, you can notice a pattern: converting the first '1' before the first '0' gives you the answer.

# Code
```php []
class Solution
{
    public function minBitwiseArray($nums)
    {
        $ans = [];

        foreach ($nums as $num) {
            if ($num == 2) {
                $ans[] = -1;
                continue;
            }

            $i = $num;
            $mask = 1;

            // Find first 0
            while ($i & 1) {
                $mask <<= 1;
                $i >>= 1;
            }

            // Convert previous 1 from first 0 to 0
            $ans[] = $num ^ ($mask >> 1);
        }

        return $ans;
    }
}
```
['PHP']