Java Simple !!
Step 1--> Firstly we have to check how many bits are set , it can be 1 ,2 ,3 or more .\nwe all know the table of bitwise OR\n0  0--> 0\n1  1-->1\n1  0-->1\n1  1
Step 1--> Firstly we have to check how many bits are set , it can be 1 ,2 ,3 or more .\nwe all know the table of bitwise OR\n0  0--> 0\n1  1-->1\n1  0-->1\n1  1-->1\nFrom here we can easily conclude that by adding more and more elements the value will remain equal  or can be increase \nTake an Example -> [1,0,2,1,3]\ncorresponding binary -->\n[01, 0, 10, 01, 11]\n0    1   2   3     4 index \nNow , execution of step 1\nno of bits      |    index\n1  ->             |         0,3,4\n2  ->             |          2,4\n3 ->\n4 ->\n5 ->\nHere we have to get the max from 0 ,2     here we get  2 so  its the no. of bits are set we dont have to go further.\nWe can use TreeSet or PriorityQueue that will ultimately gives the maximum and then simply traverse the DS and get the maximum bit wise XOR of the smallest subarray .\n```\nclass Solution {\n\n    public int[] smallestSubarrays(int[] nums) {\n        TreeSet<Integer>[] sys = new TreeSet[32];\n        for (int i = 0; i < 32; i++) sys[i] = new TreeSet<>();\n        for (int i = 0; i < nums.length; i++) {\n            for (int j = 0; j < 32; j++) {\n                if ((nums[i] >> j & 1) == 1) sys[j].add(i);\n            }\n        }\n        int ans[] = new int[nums.length];\n        for (int i = 0; i < nums.length; i++) {\n            int max = i;\n            for (TreeSet<Integer> set : sys) {\n                if (!set.isEmpty()) {\n                    max = Math.max(max, set.first());\n                    set.remove(i);\n                }\n            }\n            ans[i] = (max - i + 1);\n        }\n        return ans;\n    }\n}\n```\n
['Bit Manipulation', 'Java']