Tap here to switch tabs
Problem
Submissions

Problem: Bitwise ORs of Subarrays

Bitwise ORs of Subarrays asks you to examine every nonempty contiguous subarray, compute its bitwise OR, and return how many distinct results appear.

Statement

Given an integer array arr, consider every non empty contiguous subarray of arr. For each such subarray, compute the bitwise OR of all its elements. Return the number of distinct values that can appear among these bitwise OR results.

Constraints:

  • 1≤1 \leq arr.length ≤5⋅104\leq 5 \cdot 10^4

  • 0≤0 \leq arr[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Bitwise ORs of Subarrays

Bitwise ORs of Subarrays asks you to examine every nonempty contiguous subarray, compute its bitwise OR, and return how many distinct results appear.

Statement

Given an integer array arr, consider every non empty contiguous subarray of arr. For each such subarray, compute the bitwise OR of all its elements. Return the number of distinct values that can appear among these bitwise OR results.

Constraints:

  • 1≤1 \leq arr.length ≤5⋅104\leq 5 \cdot 10^4

  • 0≤0 \leq arr[i] ≤109\leq 10^9