Skip to content

Commit b3ddf81

Browse files
committed
Runtime: 62 ms (Top 9.13%) | Memory: 17.50 MB (Top 9.13%)
1 parent 6023695 commit b3ddf81

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// Runtime: 62 ms (Top 9.13%) | Memory: 17.50 MB (Top 9.13%)
2+
13
class Solution:
24
def escapeGhosts(self, ghosts: List[List[int]], target: List[int]) -> bool:
3-
t = float('inf')
4-
tx, ty = target
5-
for i, j in ghosts:
6-
t = min(t, abs(tx - i) + abs(ty - j))
7-
return t > abs(tx) + abs(ty)
5+
6+
dist = lambda x : abs(x[0] - target[0]) + abs(x[1] - target[1])
7+
8+
return dist((0,0)) < min(dist(g) for g in ghosts)

0 commit comments

Comments
 (0)