Leetcode 805 Solution

This article provides solution to leetcode question 805 (escape-the-ghosts)

https://leetcode.com/problems/escape-the-ghosts

Solution

class Solution:
    def escapeGhosts(self, ghosts: List[List[int]], target: List[int]) -> bool:
        limit = int(abs(target[0])) + int(abs(target[1]))
        for ghost in ghosts:
            if int(abs(ghost[0] - target[0])) + int(abs(ghost[1] - target[1])) < limit:
                return False
        return True