Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    1453 - Maximum Number of Darts Inside of a Circular Dartboard.

    Hard

    Alice is throwing n darts on a very large wall. You are given an array darts where <code>dartsi = 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.

    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.

    Given the integer r, return the maximum number of darts that can lie on the dartboard.

    Example 1:

    Input: darts = [-2,0,2,0,0,2,0,-2], r = 2

    Output: 4

    Explanation: Circle dartboard with center in (0,0) and radius = 2 contain all points.

    Example 2:

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

    Output: 5

    Explanation: Circle dartboard with center in (0,4) and radius = 5 contain all points except the point (7,8).

    Constraints:

    • 1 &lt;= darts.length &lt;= 100

    • darts[i].length == 2

    • <code>-10<sup>4</sup><= x<sub>i</sub>, y<sub>i</sub><= 10<sup>4</sup></code>

    • 1 &lt;= r &lt;= 5000

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Integer numPoints(Array<IntArray> points, Integer r)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait