Tap here to switch tabs
Problem
Submissions

Problem: Bitwise ORs of Subarrays

med
30 min
Try to solve the Bitwise ORs of Subarrays problem.

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:

  • 11 \leq arr.length 5104\leq 5 \cdot 10^4

  • 00 \leq arr[i] 109\leq 10^9

Tap here to switch tabs
Problem
Submissions

Problem: Bitwise ORs of Subarrays

med
30 min
Try to solve the Bitwise ORs of Subarrays problem.

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:

  • 11 \leq arr.length 5104\leq 5 \cdot 10^4

  • 00 \leq arr[i] 109\leq 10^9