bitmask solution  explain
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n*32)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> minBitwiseArray(vector<int>& nums) {\n        int n=nums.size();\n\n        vector<int>ans(n,-1);\n\n        for(int i=0;i<nums.size();i++){\n            int num=nums[i];\n\n            if(num<=2)continue;\n\n            vector<int>bit(32,0);//used for calculating bits of num\n\n            for(int j=0;j<31;j++){\n\n                int digit=(num>>j)&1;\n\n                bit[j]=digit;\n\n            }\n\n            int tempans=num-1; //always num-1 answer is possible as num is prime number so it is always odd if we neglect one then tempans is equal to num-1\n\n            int sum=num;//total sum\n\n\n\n            //below loop is traversing and neglect the bit which has bit[j]=1; and calculate the currsum that is check  . if check is possible ans then we update tempans \n            for(int j=0;j<31;j++){\n\n                if(bit[j]){\n\n                    int check=sum-(1<<j);\n\n                    if((check|(check+1))==num){tempans=min(tempans,check);}\n                }\n\n            }\n            \n            ans[i]=tempans; //minimum of all            \n\n        }\n\n        return ans;\n    }\n};\n```
['Array', 'Bitmask', 'C++']