python bit + hashmap + reverse traversal O(N*log(max(nums))) tc
a much more challenging problem than I expected, you need to spot some tricks.\n1. traverse in reversal\n2. the maximum_or must be or the whole array, hence, th
a much more challenging problem than I expected, you need to spot some tricks.\n1. traverse in reversal\n2. the maximum_or must be or the whole array, hence, the right subarray max or must be \nthe \'suffing accumulative or\'\n3. hashmap goes into comparing current nums with current maximum suffix or. If cur num bit is 0 and cur or is 1 in this digit, mean we want to find a number with 1 at that digit to or with it. We use a hashmap to store the last index we encounter in that bit digit. Of all cases, we know the maximum last index we include all 1 digits we need.\n```\nclass Solution:\n    def smallestSubarrays(self, nums: List[int]) -> List[int]:\n        run_or = 0\n        dp = []\n        hashmap = {}\n        for i in range(len(nums)-1,-1,-1):\n            run_or |= nums[i]\n            temp = 1\n            minimax = i\n            counts = 0\n            while temp <= run_or:\n                if nums[i] & temp:\n                    hashmap[counts] = i\n                if run_or&temp and  nums[i]&temp == 0:\n                    minimax = max(minimax,hashmap[counts])\n                counts += 1\n                temp <<=1\n            dp.append(minimax-i+1)\n        return dp[::-1]
[]