Tap here to switch tabs
Problem
Submissions

Problem: Count Pairs With XOR in a Range

Count Pairs With XOR in a Range asks you to count pairs in an integer array whose bitwise XOR falls within given lower and upper bounds, counting each pair once.

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] XOR{ XOR } nums[j]) ≤\leq high.

Constraints:

  • 1≤1 \leq nums.length ≤2×104\leq 2 \times 10^4

  • 1≤1 \leq nums[i] ≤2×104\leq 2 \times 10^4

  • 1≤1 \leq low ≤\leq high ≤2×104\leq 2 \times 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Pairs With XOR in a Range

Count Pairs With XOR in a Range asks you to count pairs in an integer array whose bitwise XOR falls within given lower and upper bounds, counting each pair once.

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] XOR{ XOR } nums[j]) ≤\leq high.

Constraints:

  • 1≤1 \leq nums.length ≤2×104\leq 2 \times 10^4

  • 1≤1 \leq nums[i] ≤2×104\leq 2 \times 10^4

  • 1≤1 \leq low ≤\leq high ≤2×104\leq 2 \times 10^4