bits
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& arr) {\n    int n=arr.size();\n    vector<vector<int>>suffix(n);\n    vector<int>suff(32,n);\n    int sum=0;\n    \n    for(int i=n-1;i>=0;i--){\n        for(int j=0;j<32;j++){\n            if(arr[i]&(1<<j)){\n              suff[j]=i;\n             }\n        }\n        suffix[i]=suff;\n        sum |=arr[i];\n    }\n    vector<int>ans;\n    for(int i=0;i<n;i++){\n        int right=i;\n        for(int j=0;j<32;j++){\n            if(suffix[i][j]!=n){\n                right=max(right,suffix[i][j]);\n            }\n        }\n        cout<<right<<endl;\n        ans.push_back(right-i+1);\n    }\n    //cout<<endl;\n    return ans;\n\n\n    }\n};\n```
['C++']