C++ || DP || Bitmasking
\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        vector<vector<int>> dp(n, vector<int>
```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        vector<vector<int>> dp(n, vector<int>(31));\n        \n        for(int i = 0; i < 31; i++) {\n            if(nums[n-1] & (1<<i)) \n                dp[n-1][i] = n-1;\n        }\n        \n        for(int i = n-2; i >= 0; i--) {\n            dp[i] = dp[i+1];\n            for(int j = 0; j < 31; j++) {\n                if(nums[i] & (1<<j))\n                    dp[i][j] = i;\n            }\n        }\n        \n        vector<int> ans(n, 1);\n        for(int i = 0; i < n; i++) {\n            for(int j = 0; j < 31; j++)\n                ans[i] = max(ans[i], dp[i][j]-i+1);\n        }\n        \n        return ans;\n    }\n};\n\n```
['Dynamic Programming', 'Bit Manipulation', 'C']