447. Number of Boomerangs

Givennpoints in the plane that are all pairwise distinct, a "boomerang" is a tuple of points(i, j, k)such that the distance betweeniandjequals the distance betweeniandk(the order of the tuple matters).

Find the number of boomerangs. You may assume thatnwill be at most500and coordinates of points are all in the range[-10000, 10000](inclusive).

Example:
Input:[[0,0],[1,0],[2,0]]Output:2Explanation:The two boomerangs are[[1,0],[0,0],[2,0]]and[[1,0],[2,0],[0,0]]

这题题意理解半天。。。 问的是点到点距离相同时 他们的排列组合共有多少种。第一, 这个距离不是固定的, 只要从一堆点中找到几个点距离之间相等, 算他们的排列组合综合。

题目不难, 正确理解题意比较难~~~~

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容