O(N) || Easy and precise C++ solution
\n# Approach\n Describe your approach to solving the problem. \nCount array will store the next occurence of each (1)bit\nJust keep traversing array from backsi
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nCount array will store the next occurence of each (1)bit\nJust keep traversing array from backside and if any bit is 1, then store it\'s index in count array. Then find the maximum index stored in the count array. That will be anser for that index.\n\n# Complexity\n- Time complexity: O(32*n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(32)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        vector<int> ans;\n        vector<int> count(32, 0);\n\n        for(int i=nums.size()-1;i>=0;i--){\n            int maxi=0;\n            for(int j=0;j<32;j++){\n                if ((1<<j) & nums[i]){\n                    count[j]=i;\n                }\n            }\n            for(int j=0;j<32;j++){\n                maxi=max(maxi, count[j]);\n            }\n            \n            ans.push_back(max(maxi-i+1, 1));\n        }\n        reverse(ans.begin(), ans.end());\n        return ans;\n    }\n};\n```
['C++']