Skip to content

Practice Maximum Number of Darts Inside of a Circular Dartboard

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#1453
LeetCode Problem

Maximum Number of Darts Inside of a Circular Dartboard

Problem Statement

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 ith dart that Alice threw on the wall. 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 lie on the dartboard. Given the integer r, return the maximum number of darts that can lie on the dartboard.

Source: Maximum Number of Darts Inside of a Circular Dartboard on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
darts = [[-2,0],[2,0],[0,2],[0,-2]], r = 2
Output
4

# Example 2

Input
darts = [[-3,0],[3,0],[2,6],[5,4],[0,9],[7,8]], r = 5
Output
5

Constraints

1 <= darts.length <= 100
darts[i].length == 2
-10^4 <= xi, yi <= 10^4
All the darts are unique
1 <= r <= 5000

Related LeetCode Problems

Practice more problems similar to Maximum Number of Darts Inside of a Circular Dartboard.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.