Tap here to switch tabs
Problem
Submissions

Problem: Number of Boomerangs

med
30 min
Try to solve the Number of Boomerangs problem.

Statement

You are given an array points where points[i] = [x_i, y_i] represents a distinct point on the X−YX-Y plane.

A boomerang is a tuple of points (i, j, k) such that the distance between points[i] and points[j] is equal to the distance between points[i] and points[k], where i, j, and k are all distinct indices.

Return the total number of boomerangs.

Constraints:

  • n == points.length

  • 1≤n≤5001 \leq n \leq 500

  • points[i].length ==2== 2

  • −104≤xi,yi≤104-10^4 \leq x_i, y_i \leq 10^4

  • All the points are unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Boomerangs

med
30 min
Try to solve the Number of Boomerangs problem.

Statement

You are given an array points where points[i] = [x_i, y_i] represents a distinct point on the X−YX-Y plane.

A boomerang is a tuple of points (i, j, k) such that the distance between points[i] and points[j] is equal to the distance between points[i] and points[k], where i, j, and k are all distinct indices.

Return the total number of boomerangs.

Constraints:

  • n == points.length

  • 1≤n≤5001 \leq n \leq 500

  • points[i].length ==2== 2

  • −104≤xi,yi≤104-10^4 \leq x_i, y_i \leq 10^4

  • All the points are unique.