C++ Solution || Using BIT MANIPULATION
Code\ncpp []\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n=nums.size();\n        vector<int> ans;\n        v
# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n=nums.size();\n        vector<int> ans;\n        vector<int> set_bits(32,-1);\n\n        int maxOR=0;\n\n        for(int i=n-1; i>=0; i--){\n            maxOR |=nums[i];\n            int curr=nums[i];\n\n            int setting_pos=0;\n            while(curr){\n                if(curr&1){\n                    set_bits[setting_pos]=i;\n\n                }\n                    curr/=2;\n                    setting_pos++;\n                \n            }\n\n            int max_ind=*max_element(set_bits.begin(), set_bits.end());\n\n            if(max_ind==-1){\n                ans.push_back(1);\n            }\n            else{\n                ans.push_back(max_ind-i+1);\n            }\n\n        }\n\n        reverse(ans.begin(), ans.end());\n        return ans;\n    }\n};\n```
['C++']