bitmap mapping
Intuition\nWe have a set of bits that exists for the array, lets say we have \n1\n2\n4\n8\n16\netc. We are interested in the index where all these bits will be 
# Intuition\nWe have a set of bits that exists for the array, lets say we have \n1\n2\n4\n8\n16\netc. We are interested in the index where all these bits will be turned on the soonest. For this we will be tracking the list of indexes for each of the bits and the one that is maximum of the minimums will be the start position. Code might be easier to understand than the explanation.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n- O(N) * sizeof<INT>\n\n- Space complexity:\n- O(N) * sizeof<INT>\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = (int)nums.size();\n        vector<vector<int>> bits(32);\n        vector<int> indexes(32, -1);\n\n        for (int i = 0; i<n; ++i) {\n            for (int j = 0; j<31; j++) {\n                if ((nums[i]>>j) & 1) {\n                    indexes[j] = 0;\n                    bits[j].push_back(i);\n                }\n            }\n        }\n        int last = 0;\n        for (int i = 0; i<31; ++i) {\n            if (!bits[i].size()) continue;\n            if (bits[i][0] > last)\n                last = bits[i][0];\n        }\n        vector<int> ans;\n        for (int i = 0; i<n; ++i) {\n            ans.push_back(max(1,last -i +1));\n            for (int j =0; j<31; ++j) {\n                if ((nums[i]>>j) & 1) {\n                    indexes[j]++;\n                    if (indexes[j] < (int)bits[j].size())\n                        last = max(last, bits[j][indexes[j]]);\n                }\n            }\n        }\n\n        return ans;\n\n\n\n        \n        \n        \n    }\n};\n```
['C++']