💖 [EASY] INTUITION & EXPLANATION
\n\n# \uD83D\uDC93**_PLEASE CONSIDER UPVOTING_**\uD83D\uDC93\n\n \n\n\n# \u2B50 Intuition\nTo construct the minimum bitwise array ans, we need to find the small
<div align="center">\n\n# \uD83D\uDC93**_PLEASE CONSIDER UPVOTING_**\uD83D\uDC93\n\n</div>\n\n***\n# \u2B50 Intuition\nTo construct the minimum bitwise array `ans`, we need to find the smallest integer `ans[i]` such that the bitwise OR of `ans[i]` and `ans[i] + 1` equals `nums[i]`. Since `nums[i]` is guaranteed to be a prime number, we can leverage the properties of prime numbers and binary representations to derive the solution efficiently.\n\n# \u2B50 Approach\n1. **Iterate through each element in `nums`**:\n   - For each prime number `num`, we initialize `ans[i]` to `-1` to indicate that no valid number has been found yet.\n   \n\n2. **Check possible values for `ans[i]`**:\n   - We will iterate over possible values of `ans[i]` from `0` to `num - 1`.\n   - For each possible value, we check if it satisfies the condition:\n   \n     ```\n     possibleAns | (possibleAns + 1) == num\n     ```\n   - If a valid `possibleAns` is found, we set `ans[i]` to this value and break out of the loop.\n\n3. **Return the result**:\n   - If no valid value is found, `ans[i]` remains `-1`, indicating it\'s not possible to construct such an integer for that index.\n\n# \u2B50 Complexity\n- **Time complexity:**  \n  The time complexity is $$O(n \\times m)$$, where $$n$$ is the number of elements in `arr` and $$m$$ is the maximum value in `arr`. This is because, for each number in `arr`, we might check all values from `0` to `num - 1` to find a valid `ans[i]`.\n\n- **Space complexity:**  \n  The space complexity is $$O(n)$$, where $$n$$ is the size of the input array, due to the array `ans` being used to store results.\n\n# \u2B50 Code\n```java []\nclass Solution { \n    public int[] minBitwiseArray(List<Integer> arr) {\n        int[] ans = new int[arr.size()];\n\n        for (int i = 0; i < arr.size(); i++) {\n            int num = arr.get(i);\n            ans[i] = -1;\n            for (int possibleAns = 0; possibleAns < num; possibleAns++) {\n                if ((possibleAns | (possibleAns + 1)) == num) {\n                    ans[i] = possibleAns;\n                    break;\n                }\n            }\n        }\n\n        return ans;  \n    }\n}\n```
['Java']