Question: Question 1 A zero - bit array is a non - empty integer array where ALL : the bitwise AND of all elements is 0

Question 1
A zero-bit array is a non-empty integer array where ALL : the bitwise AND of all elements is 0. For example, 1,2 is a zero-bit array since 1&2=0 but 2,3 is not since 2&3=2. Here & denotes the bitwise AND operation.
1 Given an array arr of n integers, find the number of zero-bit subarrays of arr.
Note: A subarray is any contiguous segment of the array.
Example
Suppose n=3 and arr =[4,5,2].
4 Here only 5,2 and 4,5,2 are zero-bit subarrays as 5&2=0 and 4&5&2=0. Hence, we report 2 as the answer.
5
Function Description
6 editor below.
7 getZeroBitSubarrays has the following parameter: int arr[n]: an array of integers
8 Returns
long int: the number of zero-bit subarrays
Language ,C++20
2
3
hackerrank.com/test/9g3i64fshlb/questions/f27fbfl8372
19m left
(i) operation.
1 zero-bit subarrays of arr.
2 array.
Suppose n=3 and arr =[4,5,2].
as the answer.
Function Description
Complete the function getZeroBitSubarrays in the editor below.
int arr[n]: an array of integers
long int: the number of zero-bit subarrays
9 Constraints
Test Result
 Question 1 A zero-bit array is a non-empty integer array where

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!