lower_bound se kiya h
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> smallestSubarrays(vector<int>& nums) {\n        int n = nums.size();\n        vector<vector<int>> setBitIdx(31);\n        for(int i = 0; i < n; i++) {\n            int val = nums[i];\n            int idx = 0;\n            while(val) {\n                if(val % 2) setBitIdx[idx].push_back(i);\n                val = val / 2;\n                idx++;\n            }\n        }\n\n        // Debugging Output (Optional)\n        <!-- for(int i = 0; i < 31; i++) {\n            for(int j = 0; j < setBitIdx[i].size(); j++) {\n                cout << setBitIdx[i][j] << " ";\n            } cout << endl;\n        } -->\n\n        vector<int> ans(n, 1);\n        for(int i = 0; i < n; i++) {\n            int maxi = i;\n            for(int j = 0; j < 31; j++) {\n                auto it = lower_bound(setBitIdx[j].begin(), setBitIdx[j].end(), i);\n                if (it != setBitIdx[j].end()) {\n                    maxi = max(maxi, *it);\n                }\n            }\n            ans[i] = maxi - i + 1;\n        }\n        return ans;\n    }\n};\n\n```
['C++']