码迷,mamicode.com
首页 > 其他好文 > 详细

[LeetCode] Number of Boomerangs

时间:2016-11-10 03:16:24      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:between   poi   pair   oom   als   distinct   leetcode   plane   output   

 

Given n points in the plane that are all pairwise distinct, 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).

Find the number of boomerangs. You may assume that n will be at most 500 and coordinates of points are all in the range [-10000, 10000] (inclusive).

Example:

Input:
[[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]]

 

[LeetCode] Number of Boomerangs

标签:between   poi   pair   oom   als   distinct   leetcode   plane   output   

原文地址:http://www.cnblogs.com/grandyang/p/6049382.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!