**Problem Description**

Given an 1D integer array **A** containing **N** distinct integers.

Find the number of unique pairs of integers in the array whose XOR is equal to **B**.

**NOTE:**

- Pair (a, b) and (b, a) is considered to be same and should be counted once.

1 <= N <= 10^{5}

1 <= A[i], B <= 10^{7}

First argument is an 1D integer array **A**.

Second argument is an integer **B**.

Return a single integer denoting the number of unique pairs of integers in the array **A** whose XOR is equal to **B**.

Input 1:

A = [5, 4, 10, 15, 7, 6] B = 5

Input 2:

A = [3, 6, 8, 10, 15, 50] B = 5

Output 1:

1

Output 2:

2

Explanation 1:

(10 ^ 15) = 5

Explanation 2:

(3 ^ 6) = 5 and (10 ^ 15) = 5

NOTE:You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.

Sign Up

to access hints and editorial solutions for**Pairs With Given Xor**

to access hints and editorial solutions for

Loading...