Coordinate With Maximum Network Quality LeetCode solution in Python

1
class Solution:
2
def bestCoordinate(self, towers: List[List[int]], radius: int) -> List[int]:
3
return max(
4
(
5
(
6
sum(
7
qi // (1 + dist)
8
for xi, yi, qi in towers
9
if (dist := sqrt((xi - x) ** 2 + (yi - y) ** 2)) <= radius
10
),
11
[x, y],
12
)
13
for x in range(51)
14
for y in range(51)
15
),
16
key=lambda x: (x[0], -x[1][0], -x[1][1]),
17
)[1]

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0