Simple Observation
\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> bit(32, -1);\n        vec
```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> bit(32, -1);\n        vector<int> dp(n, 0);\n        dp[n-1] = nums[n-1];\n        for(int i = n-2; i>=0; i--)\n        {\n            dp[i] = (dp[i+1]|nums[i]);\n        }\n        vector<int> ans;\n        for(int i = n-1; i>=0; i--)\n        {\n            for(int b = 0; b <31; b++)\n            {\n                if((nums[i]&(1<<b)))\n                {\n                     bit[b] = i;\n                }\n            }\n            int maxi = i;\n            for(int b = 0; b < 31; b++)\n            {\n                if((dp[i]&(1<<b)))\n                    maxi = max(maxi, bit[b]);\n            }\n            ans.push_back(maxi - i + 1);\n        }\n        reverse(ans.begin(), ans.end());\n        return ans;\n    }\n};\n```
[]