class Solution(object):
def kClosest(self, points, K):
"""
:type points: List[List[int]]
:type K: int
:rtype: List[List[int]]
"""
return sorted(points, key = lambda x:x[0] ** 2 + x[1] ** 2)[:K]
leetCode 973. 最接近原点的 K 个点
最新推荐文章于 2024-05-01 09:21:10 发布