Simple java solution
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 {\n    public int[] smallestSubarrays(int[] nums) {\n        int[] bitsPositions = new int[32];\n        int[] res = new int[nums.length];\n        for(int i = nums.length -1;i >=0 ;i--) {\n            var min = updateBitsAndGenMin(i, bitsPositions, nums[i]);\n            res[i] = min;\n        }\n        return res;       \n    }\n    private int updateBitsAndGenMin(int i, int[] bitsPositions, int num) {\n        int bitPos = 0;\n        while(num >0) {\n\n            var newPos = num & 1;\n            if (newPos == 1  ) {\n                bitsPositions[bitPos] = i;\n\n            }\n            num = num >> 1;            \n            bitPos++;\n        }\n\n        int max = 0;\n        for(int k =0; k < bitsPositions.length; k++) {\n            if (bitsPositions[k] > 0) {\n                max = Math.max(bitsPositions[k], max);\n            }\n        }\n\n        return max == 0 ? 1 : max - i + 1;\n    }\n}\n```
['Java']