Python3 solution checking all possible OR values
Intuition\n Describe your first thoughts on how to solve this problem. \nIdea from problem https://leetcode.com/problems/bitwise-ors-of-subarrays/description/\n
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIdea from problem https://leetcode.com/problems/bitwise-ors-of-subarrays/description/\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def smallestSubarrays(self, nums: List[int]) -> List[int]:\n        n=len(nums)\n        res=[0]*n\n        m=defaultdict(lambda:n+1)\n        for i in range(n-1,-1,-1):\n            m2=defaultdict(lambda:n+1)\n            m2[nums[i]]=1\n            for k in m: \n                x = k|nums[i]\n                m2[x] = min(m2[x], m[k]+1)\n            m=m2\n            res[i] = m[max(m)]\n        return res\n        \n```
['Python3']