Created
June 18, 2022 17:58
-
-
Save Shogun89/d7e69c284e5272b956ec52f3a4123cce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def countPoints(self, points: List[List[int]], queries: List[List[int]]) -> List[int]: | |
output = [] | |
def point_distance(circ, point): | |
dist = ((circ[0] - point[0])**2 + (circ[1] - point[1])**2 )**(1/2) | |
return dist | |
for circ in queries: | |
count = 0 | |
radius = circ[2] | |
for point in points: | |
dist = point_distance(circ, point) | |
if dist <= radius: | |
count +=1 | |
output.append(count) | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solution to this https://leetcode.com/problems/queries-on-number-of-points-inside-a-circle/