1453. Maximum Number of Darts Inside of a Circular Dartboard Hard
1/**
2 * [1453] Maximum Number of Darts Inside of a Circular Dartboard
3 *
4 * Alice is throwing n darts on a very large wall. You are given an array darts where darts[i] = [xi, yi] is the position of the i^th dart that Alice threw on the wall.
5 * Bob knows the positions of the n darts on the wall. He wants to place a dartboard of radius r on the wall so that the maximum number of darts that Alice throws lies on the dartboard.
6 * Given the integer r, return the maximum number of darts that can lie on the dartboard.
7 *
8 * Example 1:
9 * <img alt="" src="https://assets.leetcode.com/uploads/2020/04/29/sample_1_1806.png" style="width: 248px; height: 211px;" />
10 * Input: darts = [[-2,0],[2,0],[0,2],[0,-2]], r = 2
11 * Output: 4
12 * Explanation: Circle dartboard with center in (0,0) and radius = 2 contain all points.
13 *
14 * Example 2:
15 * <img alt="" src="https://assets.leetcode.com/uploads/2020/04/29/sample_2_1806.png" style="width: 306px; height: 244px;" />
16 * Input: darts = [[-3,0],[3,0],[2,6],[5,4],[0,9],[7,8]], r = 5
17 * Output: 5
18 * Explanation: Circle dartboard with center in (0,4) and radius = 5 contain all points except the point (7,8).
19 *
20 *
21 * Constraints:
22 *
23 * 1 <= darts.length <= 100
24 * darts[i].length == 2
25 * -10^4 <= xi, yi <= 10^4
26 * 1 <= r <= 5000
27 *
28 */
29pub struct Solution {}
30
31// problem: https://leetcode.com/problems/maximum-number-of-darts-inside-of-a-circular-dartboard/
32// discuss: https://leetcode.com/problems/maximum-number-of-darts-inside-of-a-circular-dartboard/discuss/?currentPage=1&orderBy=most_votes&query=
33
34// submission codes start here
35
36impl Solution {
37 pub fn num_points(darts: Vec<Vec<i32>>, r: i32) -> i32 {
38 0
39 }
40}
41
42// submission codes end
43
44#[cfg(test)]
45mod tests {
46 use super::*;
47
48 #[test]
49 fn test_1453() {
50 }
51}
52
Back
© 2025 bowen.ge All Rights Reserved.