Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    447 - Number of Boomerangs\.

    Medium

    You are given n points in the plane that are all distinct , where <code>pointsi = x<sub>i</sub>, y<sub>i</sub></code>. 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).

    Return the number of boomerangs.

    Example 1:

    Input: points = \[\[0,0],1,0,2,0]

    Output: 2

    Explanation: The two boomerangs are [1,0,0,0,2,0] and [1,0,2,0,0,0].

    Example 2:

    Input: points = \[\[1,1],2,2,3,3]

    Output: 2

    Example 3:

    Input: points = \[\[1,1]]

    Output: 0

    Constraints:

    • n == points.length

    • 1 &lt;= n &lt;= 500

    • points[i].length == 2

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

    • All the points are unique.

    • 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 numberOfBoomerangs(Array<IntArray> points)
      • Methods inherited from class java.lang.Object

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