Class Solution
java.lang.Object
g0401_0500.s0447_number_of_boomerangs.Solution
447 - Number of Boomerangs.<p>Medium</p>
<p>You are given <code>n</code> <code>points</code> in the plane that are all <strong>distinct</strong> , where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>. A <strong>boomerang</strong> is a tuple of points <code>(i, j, k)</code> such that the distance between <code>i</code> and <code>j</code> equals the distance between <code>i</code> and <code>k</code> <strong>(the order of the tuple matters)</strong>.</p>
<p>Return <em>the number of boomerangs</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> points = [[0,0],[1,0],[2,0]]</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> The two boomerangs are [[1,0],[0,0],[2,0]] and [[1,0],[2,0],[0,0]].</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> points = [[1,1],[2,2],[3,3]]</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> points = [[1,1]]</p>
<p><strong>Output:</strong> 0</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>n == points.length</code></li>
<li><code>1 <= n <= 500</code></li>
<li><code>points[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>All the points are <strong>unique</strong>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
numberOfBoomerangs
public int numberOfBoomerangs(int[][] points)
-