[Java] Bit Solution with Explanation 🔥
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 n = nums.length, last[] = new int[30], res[] = new int[n];\n        for (int i = n - 1; i >= 0; --i) {\n            res[i] = 1;\n            for (int j = 0; j < 30; ++j) {\n                if ((nums[i] & (1 << j)) > 0)\n                    last[j] = i;\n                res[i] = Math.max(res[i], last[j] - i + 1);\n            }\n        }\n        return res;\n    }\n}\n```
['Java']