Simple Swift Solution
Code
![Screenshot 2025-03-27 at 12.33.34 PM.png](https://assets.leetcode.com/users/images/23980020-9ff2-45aa-a77d-0211b7974629_1743068046.8502572.png)


# Code
```swift []
class Solution {
    func minBitwiseArray(_ nums: [Int]) -> [Int] {
        var result = [Int]()
        for num in nums {
            var found = false
            for i in 0...num {
                if i | (i + 1) == num {
                    result.append(i)
                    found = true
                    break
                }
            }
            if !found {
                result.append(-1)
            }
        }
        return result
    }
}
```
['Swift']