C++ || SIMPLE || EASY TO UNDERSTAND
Code\n\nclass Solution {\npublic:\n    bool check(vector<int> &v1,int &x){\n        for(int i = 0; i <=31; i++){\n            if(!v1[i] && (x&(1<<i))){\n       
# Code\n```\nclass Solution {\npublic:\n    bool check(vector<int> &v1,int &x){\n        for(int i = 0; i <=31; i++){\n            if(!v1[i] && (x&(1<<i))){\n                return true;\n            }\n        }\n        return false;\n    }\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        if(n==1)return {1};\n        vector<int> v1(32,0);\n        int i = 0, j = 0,k;\n        vector<int> ans;\n        vector<int> v2(n);\n        v2[n-1] = nums[n-1];\n        for(i = n-2; i >= 0; i--){\n            v2[i] = (nums[i]|v2[i+1]);\n        }\n        // for(auto &i: v2)cout<<i<<" ";\n        i = 0, j = 0;\n        while(i<n){\n            if(v2[i]==0){\n                ans.push_back(1);\n                i++;\n                j++;\n                continue;\n            }\n            while(j<n && check(v1,v2[i])){\n                for(k = 0; k <= 31; k++){\n                    if(nums[j]&(1<<k)){\n                        v1[k]++;\n                    }\n                }\n                j++;\n            }\n            ans.push_back(j-i);\n            for(k = 0; k <= 31; k++){\n                if(nums[i]&(1<<k)){\n                    v1[k]--;\n                }\n            }\n            i++;\n        }\n        return ans;\n    }\n};\n```
['Array', 'Two Pointers', 'Bit Manipulation', 'Sliding Window', 'C++']