Faster than 100% and Memory usage less than 100%
class Solution {\npublic:\n    vector smallestSubarrays(vector& v) {\n        int n=v.size();\n        vector ans;\n        vector dp(31);\n        for(int i=n-
class Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& v) {\n        int n=v.size();\n        vector<int> ans;\n        vector<int> dp(31);\n        for(int i=n-1;i>=0;i--)\n        {\n            for(int j=0;j<31;j++)\n            {\n              if(v[i] & 1<<j)\n                  dp[j]=i;\n            }\n            int mx=0;\n            for(int j=0;j<31;j++)\n                mx=max(mx,dp[j]);\n            ans.push_back(max(1,mx-i+1));\n        }\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};
[]