Tap here to switch tabs
Problem
Submissions

Problem: Count Good Subarrays

Count Good Subarrays asks you to examine an integer array and count every contiguous subarray whose bitwise OR is also equal to one of its elements.

Statement

Given an integer array nums, a subarray is called good if the bitwise OR of all elements in the subarray is present as an element within that same subarray.

Return the total number of good subarrays in nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Good Subarrays

Count Good Subarrays asks you to examine an integer array and count every contiguous subarray whose bitwise OR is also equal to one of its elements.

Statement

Given an integer array nums, a subarray is called good if the bitwise OR of all elements in the subarray is present as an element within that same subarray.

Return the total number of good subarrays in nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

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