447. Number of Boomerangs Medium
1/**
2 * [447] Number of Boomerangs
3 *
4 * 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).
5 * Return the number of boomerangs.
6 *
7 * Example 1:
8 *
9 * Input: points = [[0,0],[1,0],[2,0]]
10 * Output: 2
11 * Explanation: The two boomerangs are [[1,0],[0,0],[2,0]] and [[1,0],[2,0],[0,0]].
12 *
13 * Example 2:
14 *
15 * Input: points = [[1,1],[2,2],[3,3]]
16 * Output: 2
17 *
18 * Example 3:
19 *
20 * Input: points = [[1,1]]
21 * Output: 0
22 *
23 *
24 * Constraints:
25 *
26 * n == points.length
27 * 1 <= n <= 500
28 * points[i].length == 2
29 * -10^4 <= xi, yi <= 10^4
30 * All the points are unique.
31 *
32 */
33pub struct Solution {}
34
35// problem: https://leetcode.com/problems/number-of-boomerangs/
36// discuss: https://leetcode.com/problems/number-of-boomerangs/discuss/?currentPage=1&orderBy=most_votes&query=
37
38// submission codes start here
39
40impl Solution {
41 pub fn number_of_boomerangs(points: Vec<Vec<i32>>) -> i32 {
42 0
43 }
44}
45
46// submission codes end
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_447() {
54 }
55}
56
Back
© 2025 bowen.ge All Rights Reserved.