Tap here to switch tabs
Problem
Submissions

Problem: Count Pairs With XOR in a Range

med
30 min
Try to solve the Count Pairs With XOR in a Range problem.

Statement

Given an integer array nums and two integers low and high, return the number of pairs (i,j)(i, j) such that 0≤i<j<0 \leq i < j < nums.length and low ≤\leq (nums[i] $ ext{ XOR }$ nums[j]) ≤\leq high.

Constraints:

  • 1≤1 \leq nums.length ≤2imes104\leq 2 imes 10^4

  • 1≤1 \leq nums[i] ≤2imes104\leq 2 imes 10^4

  • 1≤1 \leq low ≤\leq high ≤2imes104\leq 2 imes 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Pairs With XOR in a Range

med
30 min
Try to solve the Count Pairs With XOR in a Range problem.

Statement

Given an integer array nums and two integers low and high, return the number of pairs (i,j)(i, j) such that 0≤i<j<0 \leq i < j < nums.length and low ≤\leq (nums[i] $ ext{ XOR }$ nums[j]) ≤\leq high.

Constraints:

  • 1≤1 \leq nums.length ≤2imes104\leq 2 imes 10^4

  • 1≤1 \leq nums[i] ≤2imes104\leq 2 imes 10^4

  • 1≤1 \leq low ≤\leq high ≤2imes104\leq 2 imes 10^4