very simple and Easy Solution using segment Tree+Two pointer+Prefix OR
Intuition\nFirst find the maximum value for each subarray using reverse prefix or\nthen start from the right hand side and try to reduce the boundary \nsee the 
# Intuition\nFirst find the maximum value for each subarray using reverse prefix or\nthen start from the right hand side and try to reduce the boundary \nsee the solution you will easily understand.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(NlogN)\n\n- Space complexity:\nO(N)\n\n# Code\n```\n\nclass SegmentTree{\n  vector <int> seg;\n    public:\n    SegmentTree(int n)\n    {\n        seg.resize(4*n,0);\n    }\n    void build(int node,int l,int r,vector <int> &nums)\n    {\n        if(l==r)\n        {\n            seg[node] = nums[l];\n            return;\n        }\n        int mid = (l+r)>>1;\n        build(2*node+1,l,mid,nums);\n        build(2*node+2,mid+1,r,nums);\n        \n        seg[node] = seg[2*node+1]|seg[2*node+2];\n    }\n    \n    int query(int node,int left,int right,int l,int r)\n    {\n        if(l>r||r<left||right<l) return 0;\n        if(l>=left&&r<=right) return seg[node];\n        \n        int mid = (l+r)>>1;\n        return query(2*node+1,left,right,l,mid) | query(2*node+2,left,right,mid+1,r);\n    }\n};\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        SegmentTree segmentTree(n);\n       segmentTree.build(0,0,n-1,nums);\n        vector <int> maxOR(n);\n        maxOR[n-1] = nums[n-1];\n        for(int i=n-2;i>=0;i--)\n        {\n            maxOR[i] = maxOR[i+1] | nums[i];\n        }\n        int i=n-2,j=n-1;\n        vector <int> ans(n);\n        ans[n-1] = 1;\n        \n        while(i>=0)\n        {\n            while(i<j&&segmentTree.query(0,i,j-1,0,n-1)>=maxOR[i])\n                j--;\n            ans[i] = j-i+1;\n            i--;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'Segment Tree', 'Prefix Sum', 'C++']