Count Pairs With Xor In A Range

medium
Given an integer array nums and two integers low and high.
Count number of pairs of indexes (i, j) for which both of this expression's are satisfied:
1. 0 <= i < j < nums.length
2. low <= nums[i] ^ nums[j] <= high

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1. 1 <= nums.length <= 2 * 10^4
2. 1 <= nums[i] <= 2 * 10^4
3. 1 <= low <= high <= 2 * 10^4

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
4
1
4
2
7
3
5
Output
4
Previous
Stream Of Characters
Next
Replace Words

Related Questions