Simple Java Solution
Code\n\nclass Solution {\n    public int[] smallestSubarrays(int[] nums) {\n        int result[]=new int[nums.length];\n        int max=0;\n        for(int i=0;
# Code\n```\nclass Solution {\n    public int[] smallestSubarrays(int[] nums) {\n        int result[]=new int[nums.length];\n        int max=0;\n        for(int i=0;i<nums.length;i++)\n        {\n            if(nums[i]>max)\n            {\n                max=nums[i];\n            }\n        }\n        String str=Integer.toBinaryString(max);\n        int ch[][]=new int[nums.length][str.length()];\n        result[result.length-1]=1;\n        int count=0;\n        str=Integer.toBinaryString(nums[nums.length-1]);\n        for(int i=str.length()-1;i>=0;i--)\n        {\n            if(str.charAt(i)==\'1\')\n            {\n                ch[nums.length-1][count]=1;\n            }\n            count++;\n        }\n        \n        int start=nums.length-1;\n        for(int i=nums.length-2;i>=0;i--)\n        {\n           int x=nums[i];\n           count=0;\n           while(x>0)\n           {\n             int p=( x & 1);\n             if(p==1)\n             {\n                 ch[i][count]=1;\n             }\n             x>>=1;\n            count++;\n           }\n           for(int j=0;j<ch[i].length;j++)\n           {\n            ch[i][j]+=ch[i+1][j];\n           }\n           while(start!=i)\n           {\n                int flag=0;\n                for(int j=0;j<ch[i].length;j++)\n                {\n                   \n                    if(ch[i][j]!=0 && ch[i][j]-ch[start][j]==0)\n                    {\n                        \n                        flag=1;\n                        break;\n                    }\n                }\n                \n            if(flag==0)\n            {\n                 start--;\n            }\n            else\n            {\n                break;\n            }\n           }\n           result[i]=start-i+1;\n\n        }\n\n        return result;\n\n    }\n}\n```
['Java']