Practice Bitwise ORs of Subarrays
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an integer array arr, return the number of distinct bitwise ORs of all the non-empty subarrays of arr. The bitwise OR of a subarray is the bitwise OR of each integer in the subarray. The bitwise OR of a subarray of one integer is that integer. A subarray is a contiguous non-empty sequence of elements within an array.
Source: Bitwise ORs of Subarrays on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
arr = [0]
Output
1
# Example 2
Input
arr = [1,1,2]
Output
3
# Example 3
Input
arr = [1,2,4]
Output
6
Constraints
1 <= arr.length <= 5 * 10^4
0 <= arr[i] <= 10^9
Related LeetCode Problems
Practice more problems similar to Bitwise ORs of Subarrays.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.