Simple For loop | TC - O(n*32)
Idea - Traverse from right and check for each index i  at what min index the the jth bit of nums[i] is set. Take the max of all these indices and subtract from 
**Idea** - Traverse from right and check for each index i  at what min index the the jth bit of nums[i] is set. Take the max of all these indices and subtract from the curent index to get the answer for nums[i]. store it in a vector and return.\n\n```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        \n        vector<int> v;\n        vector<int> minIndex(33, 0);\n        \n        for(int i = nums.size() - 1; i >= 0; --i) {\n            \n            for(int j = 31; j >= 0; --j) {\n                \n                // check if the jth bit is set or not\n                if(nums[i]&(1<<j)) {\n            \n                    minIndex[j] = i;\n                }\n            }\n            \n            int ans = i;\n            for(int j = 31; j >= 0; --j) {\n                ans = max(ans, minIndex[j]);\n            }\n            \n            v.push_back(ans - i + 1);\n        }\n        \n        reverse(v.begin(), v.end());\n        return v;\n    }\n};\n```
['C']