Question: e hackerrank.com / test / 1 osk 0 dhn 7 a 2 / que YouTube Maps For an array arr of n positive integers, count

e
hackerrank.com/test/1osk0dhn7a2/que
YouTube
Maps
For an array arr of n positive integers, count the unordered pairs (i, j)(0<= i < j < n) where arr[i] XOR arr[j]> arr[i]* AND arr[j]. XOR denotes the bitwise XOR operation and AND denotes the bitwise AND operation.
Example
Given n =4, arr =[4,3,5,2]. All unordered pairs (i, j) are-
Indices XOR AND XOR > AND
(0,1)
7
True
( odot,2)
1
4
False
(0,3)
6
6
True
(1,2)
1
True
(1,3)
1
2
False
(2,3)
7
True
For the first line:
arr[0]=4, arr[1]=34OR *3=7
4AND *3=0
7>3
Q
Search

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!