Concise code | Beats 100%
Code\npython3 []\nclass Solution:\n    def minBitwiseArray(self, nums: List[int]) -> List[int]:\n        """\n        a | a+1 = y = num\n        y - a = (some p
# Code\n```python3 []\nclass Solution:\n    def minBitwiseArray(self, nums: List[int]) -> List[int]:\n        """\n        a | a+1 = y = num\n        y - a = (some power of 2) = (1 << i) i from 1 to 30\n        a = y - (some power of 2)\n        a | a+1 = num\n        where a = num - (1<<i) i->1 to 30\n        """\n\n        def solve(num):\n            if num == 2:\n                return -1\n\n            mini = num\n            for i in range(31):\n                a = num - (1 << i)\n                if (a | (a + 1)) == num:\n                    mini = min(mini, a)\n            return mini\n\n        return [solve(num) for num in nums]\n\n```
['Math', 'Bit Manipulation', 'Python3']