Easy O(n*32) java solution
\nclass Solution {\n    public int[] smallestSubarrays(int[] nums) {\n        int[] map = new int[32];\n        int[] res = new int[nums.length];\n        for (
```\nclass Solution {\n    public int[] smallestSubarrays(int[] nums) {\n        int[] map = new int[32];\n        int[] res = new int[nums.length];\n        for (int i = nums.length - 1; i >= 0; i--) {\n            int num = nums[i];\n            for (int j = 0; j <= 31; j++) {\n                int mask = 1 << (j);\n                if ((num & mask) > 0) {\n                    map[j] = i;\n                }\n            }\n            \n            int max = i;\n            for (int e : map) max = Math.max(e, max);\n            res[i] = max - i + 1;\n        }\n        return res;\n    }\n}\n```
['Java']