0898. Bitwise ORs of Subarrays
https://leetcode.com/problems/bitwise-ors-of-subarrays
Description
We have an array arr
of non-negative integers.
For every (contiguous) subarray sub = [arr[i], arr[i + 1], ..., arr[j]]
(with i <= j
), we take the bitwise OR of all the elements in sub
, obtaining a result arr[i] | arr[i + 1] | ... | arr[j]
.
Return the number of possible results. Results that occur more than once are only counted once in the final answer
Example 1:
Example 2:
Example 3:
Constraints:
1 <= nums.length <= 5 * 104
0 <= nums[i] <= 109
ac
Last updated