Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
leetcode: finished #789
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Sep 11, 2023
1 parent 1b05bf5 commit 7d049a2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions content/leetcode/2023/9.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@ title: 2023.9
draft: false
---

# 2023.9.11

```python
#
# @lc app=leetcode.cn id=789 lang=python3
#
# [789] 逃脱阻碍者
#

# @lc code=start
from typing import List


class Solution:
def escapeGhosts(self, ghosts: List[List[int]], target: List[int]) -> bool:
def distance(p1, p2):
return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])

my_distance = distance([0, 0], target)
for ghost in ghosts:
ghost_distance = distance(ghost, target)
if ghost_distance <= my_distance:
return False
return True


# @lc code=end
```

# 2023.9.10

```python
Expand Down

0 comments on commit 7d049a2

Please sign in to comment.