Showing:
Handle Score
@Ibrahim Nash 6564
@mb1973 5785
@Quandray 5275
@akhayrutdinov 5111
@saiujwal13083 5074
@kirtidee18 4639
@sanjay05 3762
@mantu_singh 3712
@gfgaccount 3627
@marius_valentin_dragoi 3525
Counts Zeros Xor Pairs
Easy Accuracy: 58.11% Submissions: 3061 Points: 2

Given an array A[] of size N. Find the number of pairs (i, j) such that
AXOR Aj = 0, and 1 ≤ i < j ≤ N.

Example 1:

â€‹Input : arr[ ] = {1, 3, 4, 1, 4}
Output : 2
Explanation:
Index( 0, 3 ) and (2 , 4 ) are only pairs
whose xors is zero so count is 2.


â€‹Example 2:

Input : arr[ ] = {2, 2, 2}
Output :  3



This is a function problem. The input is already taken care of by the driver code. You only need to complete the function calculate() that takes an array (arr), sizeOfArray (n), and return the count of Zeros Xor's Pairs. The driver code takes care of the printing.

Expected Time Complexity: O(N*Log(N)).
Expected Auxiliary Space: O(1).

Output:
For each test case, output a single integer i.e counts of Zeros Xors Pairs

Constraints
2 ≤ N ≤ 10^5
1 ≤ A[i] ≤ 10^5