Skip to content

Latest commit

 

History

History
executable file
·
15 lines (8 loc) · 562 Bytes

447.md

File metadata and controls

executable file
·
15 lines (8 loc) · 562 Bytes

447. Number of Boomerangs

You are given n points in the plane that are all distinct, where points[i] = [xi, yi]. A boomerang is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters).

Return the number of boomerangs.

n^2 to preprocess the distance.

n^3 to find the tuple?

oh 500^3 tle. We shall find i,j and all the distance that satisfy (i,k)? then we can do it in o(n^2)?

AC! yes use an unordered_map to store the count of (i,distance)

and the answer + (i,distance) AC!