permutation

5P3 - 5!/(5-3)!

boomerang - three points same distance
loop through each point and count the number of pairs of same distanced, then add their permutations as well

1
2
3
4
5
6
7
8
9
10
11
res = 0
for i in range(m):
for j in range(m):
if i==j: continue
distance = calcDistance(points[i],points[j])
dic[distance]+=1
for v in dic.values():
res += v * (v-1) #the permutation of selecting 2 elements
dic = {}
return res