1828. Queries on Number of Points Inside a Circle

Updated: 2024-03-12
1 min read
[]

On This Page

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