[C++] | Bitwise XOR
\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        vector<int> closed(30);\n        vector<int> res(nums.size());\n   
```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        vector<int> closed(30);\n        vector<int> res(nums.size());\n        for(int i = nums.size()- 1; i >= 0; i--){\n            for(int j = 0; j < 30; j++)\n                if(nums[i] & (1 << j))\n                    closed[j] = i;\n            res[i] = max(1, *max_element(closed.begin(), closed.end()) - i + 1);\n        }\n        return res;\n    }\n};\n```
[]