Skip to content

Commit 449f636

Browse files
authored
Add numberOfBoomerangs function
Implement function to calculate number of boomerangs based on given points.
1 parent b51e6fe commit 449f636

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @param {number[][]} points
3+
* @return {number}
4+
*/
5+
var numberOfBoomerangs = function(points) {
6+
7+
for (let i = 0; i < points.length; i++){
8+
for (let j = 0; j<points.length; j++){
9+
let x1 = points[i][0];
10+
let y1 = points[i][1];
11+
12+
let x2 = points[j][0];
13+
let y2 = points[j][1];
14+
15+
let dis = (x2-x1)**2 + (y2-y1)**2;
16+
}
17+
}
18+
19+
};

0 commit comments

Comments
 (0)