C++ || O(n*32) || Bits Manipulation ||
C++ Code:\n\n\n bool check(int &i,int &j,vector<vector<int>>&arr){\n       for(int k=0;k<32;k++){\n         if(arr[i][k]!=0 && arr[i][k]<=arr[j][k]){\n         
**C++ Code:**\n\n```\n bool check(int &i,int &j,vector<vector<int>>&arr){\n       for(int k=0;k<32;k++){\n         if(arr[i][k]!=0 && arr[i][k]<=arr[j][k]){\n             return false;\n         }\n     }\n      return true;  \n    }\n    vector<int> smallestSubarrays(vector<int>& nums) {\n     int n = nums.size();\n     vector<vector<int>>arr(n,vector<int>(32,0));\n        \n      // decimal to binary conversion   \n     for(int i=0;i<n;i++){\n         int a = nums[i];\n         int j = 31;\n         while(a>0){\n             if(a%2!=0) arr[i][j] = 1;\n             j--;\n             a = a/2;\n         }\n     }\n        \n     // calculating prefix sum\n     for(int i=n-2;i>=0;i--){\n         for(int j=0;j<32;j++){\n             arr[i][j] += arr[i+1][j];\n        }\n     } \n     \n     vector<int>ans(n);\n     ans[n-1]=1;\n     int j=n-1;\n     for(int i=n-2;i>=0;i--){\n       while(i<j && check(i,j,arr)){\n           j--;\n       }\n       cout<<j<<" ";\n        ans[i] = j-i+1;\n     }\n     return ans;   \n    }\n```
['Bit Manipulation', 'C']