[Java/C++/Python] Low Bit, O(n)
Intuition\nans[i] OR (ans[i] + 1) == nums[i]\nans[i] and ans[i] + 1 are one odd and one even.\nnums[i] is an odd.\n\n\n# Explanation\n..0111 || (..0111 + 1)  = 
# **Intuition**\n`ans[i] OR (ans[i] + 1) == nums[i]`\n`ans[i]` and `ans[i] + 1` are one odd and one even.\n`nums[i]` is an odd.\n<br>\n\n# **Explanation**\n`..0111 || (..0111 + 1)  = ..1111`\nThe effect is that change the rightmost 0 to 1.\n\nFor each `a` in array `A`,\nfind the rightmost 0,\nand set the next bit from 1 to 0.\n\n`a + 1` will filp the 1-suffix to 0-suffix,\nand flip the rightmost 0 to 1.\n`a & -a` is a trick to get the rightmost 1.\n<br>\n\n# **Complexity**\nTime `O(n)`\nSpace `O(n)` for result\n<br>\n\n**Java**\n```java\n    public int[] minBitwiseArray(List<Integer> A) {\n        int n = A.size(), res[] = new int[n];\n        for (int i = 0; i < n; i++) {\n            int a = A.get(i);\n            if (A.get(i) % 2 == 0) {\n                res[i] = -1;\n            } else {\n                res[i] = a - ((a + 1) & (-a - 1)) / 2;\n            }\n        }\n        return res;\n    }\n```\n\n**C++**\n```cpp\n    vector<int> minBitwiseArray(vector<int>& A) {\n        vector<int> res;\n        for (int a : A) {\n            if (a % 2 == 0) {\n                res.push_back(-1);\n            } else {\n                res.push_back(a - ((a + 1) & (-a - 1)) / 2);\n            }\n        }\n        return res;\n    }\n```\n\n**Python**\n```py\n    def minBitwiseArray(self, A: List[int]) -> List[int]:\n        res = []\n        for a in A:\n            if a % 2 == 0:\n                res.append(-1)\n            else:\n                res.append(a - ((a + 1) & (-a - 1)) // 2)\n        return res\n```\n
['C', 'Python', 'Java']