Approach hintTry it first, then revealHide
OR values of subarrays ending at a fixed index only gain bits as the start moves left, so there are at most about 30 distinct ones. Carry that small set along the scan and add its members to a global set.
OR values of subarrays ending at a fixed index only gain bits as the start moves left, so there are at most about 30 distinct ones. Carry that small set along the scan and add its members to a global set.