Class Solution
java.lang.Object
g1401_1500.s1453_maximum_number_of_darts_inside_of_a_circular_dartboard.Solution
1453 - Maximum Number of Darts Inside of a Circular Dartboard.<p>Hard</p>
<p>Alice is throwing <code>n</code> darts on a very large wall. You are given an array <code>darts</code> where <code>darts[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> is the position of the <code>i<sup>th</sup></code> dart that Alice threw on the wall.</p>
<p>Bob knows the positions of the <code>n</code> darts on the wall. He wants to place a dartboard of radius <code>r</code> on the wall so that the maximum number of darts that Alice throws lies on the dartboard.</p>
<p>Given the integer <code>r</code>, return <em>the maximum number of darts that can lie on the dartboard</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/04/29/sample_1_1806.png" alt="" /></p>
<p><strong>Input:</strong> darts = [[-2,0],[2,0],[0,2],[0,-2]], r = 2</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Explanation:</strong> Circle dartboard with center in (0,0) and radius = 2 contain all points.</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/04/29/sample_2_1806.png" alt="" /></p>
<p><strong>Input:</strong> darts = [[-3,0],[3,0],[2,6],[5,4],[0,9],[7,8]], r = 5</p>
<p><strong>Output:</strong> 5</p>
<p><strong>Explanation:</strong> Circle dartboard with center in (0,4) and radius = 5 contain all points except the point (7,8).</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= darts.length <= 100</code></li>
<li><code>darts[i].length == 2</code></li>
<li><code>-10<sup>4</sup> <= x<sub>i</sub>, y<sub>i</sub> <= 10<sup>4</sup></code></li>
<li><code>1 <= r <= 5000</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
numPoints
public int numPoints(int[][] points, int r)
-