无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

leetcode447. Number of Boomerangs

2022-02-23 09:46 作者:您是打尖兒還是住店呢  | 我要投稿

You are given?n?points?in the plane that are all?distinct, where?points[i] = [xi, yi]. 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: 2Explanation: 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 <= n <= 500

  • points[i].length == 2

  • -104?<= xi, yi?<= 104

  • All the points are?unique.

    一個函數(shù)計算2個點的尺寸,然后2個循環(huán)算出所有點之間的尺寸,map存儲,然后根據(jù)相同數(shù)量,就能算出來


Runtime:?187 ms, faster than?65.29%?of?Java?online submissions for?Number of Boomerangs.

Memory Usage:?109.6 MB, less than?68.56%?of?Java?online submissions for?Number of Boomerangs.


leetcode447. Number of Boomerangs的評論 (共 條)

分享到微博請遵守國家法律
宿州市| 都兰县| 陇川县| 张家界市| 恩平市| 元江| 安国市| 东宁县| 广丰县| 八宿县| 阿克陶县| 博湖县| 阿瓦提县| 湟源县| 栖霞市| 新建县| 兴国县| 阜宁县| 普兰店市| 沧源| 麟游县| 汝城县| 临邑县| 桑植县| 泗洪县| 泊头市| 嘉峪关市| 遂溪县| 新晃| 兴隆县| 大竹县| 吉安市| 英德市| 界首市| 湾仔区| 高密市| 靖州| 新绛县| 吕梁市| 浦县| 油尖旺区|