class Solution(object):
def kClosest(self, points, K):
"""
:type points: List[List[int]]
:type K: int
:rtype: List[List[int]]
"""
res = []
for item in points:
a = lambda x: x[0]**2 + x[1]**2
points.sort(key=a)
return points[:K]
973. 最接近原点的 K 个点
最新推荐文章于 2020-11-09 19:00:37 发布