Practice Count Pairs of Points With Distance k
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 2D integer array coordinates and an integer k, where coordinates[i] = [xi, yi] are the coordinates of the ith point in a 2D plane. We define the distance between two points (x1, y1) and (x2, y2) as (x1 XOR x2) + (y1 XOR y2) where XOR is the bitwise XOR operation. Return the number of pairs (i, j) such that i < j and the distance between points i and j is equal to k.
Source: Count Pairs of Points With Distance k on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
coordinates = [[1,2],[4,2],[1,3],[5,2]], k = 5
2
# Example 2
coordinates = [[1,3],[1,3],[1,3],[1,3],[1,3]], k = 0
10
Constraints
Related LeetCode Problems
Practice more problems similar to Count Pairs of Points With Distance k.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.