1828. Queries on Number of Points Inside a Circle

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1828

class Solution:
    def countPoints(
        self, points: List[List[int]], queries: List[List[int]]
    ) -> List[int]:
        res = []
        for x, y, r in queries:
            cnt = 0
            for i, j in points:
                dx, dy = i - x, j - y
                cnt += dx * dx + dy * dy <= r * r
            res.append(cnt)
        return res