EXPLAINED: REVERSE SLIDING WINDOW WITH BIT MANIPULATION,COUNTING
Do sliding window in reverse.\nAdd the set bits from the L index element to the bits array , meaning if L element is 2 then add one to 1st index of bits array s
Do sliding window in reverse.\nAdd the set bits from the L index element to the bits array , meaning if L element is 2 then add one to 1st index of bits array since 2=(10) in binary.\nthen try to remove the right elements by removing its set bits from bits array. if any bit you are removing has only 1 value that means if you remove right element the it would decrease the OR result so we will not remove that right element \nthe we will save r-l+1 as the as for L index.\n\nTime Complexity is linear meaning O(N) where N is the size of the nums array.\nSpace complexity is O{1), because we are just using an array of size 32 irrespective of nums array size.\n\nTime complexity is linear because it is just a normal sliding window and l and r can at max traverse the array once . the Inner loops will just run 32 times so they won\'t add any extra complexity to our solution.\n\n```\nvector<int> smallestSubarrays(vector<int>& nums) {\n        vector<int>bits(32,0);\n        \n        int r=nums.size()-1;\n        int l=nums.size()-1;\n        vector<int>ans;\n        \n        while(l>=0){\n            \n            int temp=nums[r];\n            \n            for(int i=0;i<32;i++){\n                if(nums[l]&(1<<i)){\n                    bits[i]++;\n                }\n            }\n            \n            \n            bool notchange=false;\n            while(r>l and !notchange){;\n                notchange=false;\n                vector<int>temp=bits;\n                for(int i=0;i<32;i++){\n                    if(nums[r]&(1<<i)){\n                        if(bits[i]==1){\n                            notchange=true;\n                            break;\n                        }\n                        temp[i]--;\n                    }\n                }\n                if(notchange)break;\n                r--;\n                bits=temp;\n            }\n            ans.push_back(r-l+1);\n            l--;\n        }\n        \n        \n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n```
['Bit Manipulation', 'C', 'Sliding Window']