For an array arr of n positive integ Question

Question

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 arri). 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
2
(0,2)
1
4
False
(0,3)
6
0
True
(1,2)
6
1
True
(1,3)
1
2
False
(2,3)
7
0
True
For the first line:
40°C
Mostly cloudy
arr[0] = 4, arr[1] = 3
4 XOR 3-7
4 AND 3=0
73
Lar

Details
Attachments
Purchase An Answer Below

Have a similar question?