🔥 Easy solution. Execute in 9ms, beats 100% in CPU and Memory! 🔥
Intuition\n Describe your first thoughts on how to solve this problem. \nThe number of moves that we need to reach to the target, should be less than ghosts mov
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe number of moves that we need to reach to the target, should be less than ghosts moves.\n\n# Approach\nThe idea is that we have to calculate the number of moves, that required to reach the target, for all ghosts and also according to the starting point. The # of moves for us, should be less than # of moves for ghosts.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(2n)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n\n# Code\n```swift []\nclass Solution {\n    func escapeGhosts(_ ghosts: [[Int]], _ target: [Int]) -> Bool {\n        // Calculates number of moves for us\n        let targetSum = target.reduce(into: 0){$0 += abs($1)}\n\n        // Calculates number of moves for ghosts\n        let ghostsSum = ghosts.map {\n            Int(abs($0[0] - target[0]) + abs($0[1] - target[1]))\n        }\n        \n        // ** Itereate over the ghosts moves\n        for ghost in ghostsSum {\n            if targetSum >= ghost {\n                return false\n            }\n        }\n        \n        return true\n    }\n}\n```
['Swift']