Leetcode 934 Solution
This article provides solution to leetcode question 934 (bitwise-ors-of-subarrays)
Access this page by simply typing in "lcs 934" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/bitwise-ors-of-subarrays
Solution
class Solution:
def subarrayBitwiseORs(self, A):
dp = set()
ans = set()
for a in A:
new_dp = set([a])
for x in dp:
new_dp.add(a | x)
dp = new_dp
ans |= dp
return len(ans)