Manhattan Distance
Intuition\nYou have to reach the target before any ghost is able to. The distance from any point to the target is called the \'Manhatten Distance\', which is ju
# Intuition\nYou have to reach the target before any ghost is able to. The distance from any point to the target is called the \'Manhatten Distance\', which is just the difference of the X coordinates + the difference of the Y coordinates\n\n# Approach\nFor the ghosts, use a .map() call to map each coordinate to the Manhattan distance to the target. Then take the .min() of all of the Manhattan distances\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\nScan the array of ghost coordinates one time to compute the Manhattan Distances $$O(n)$$\nTake the min value of the list of Manhattan Distances, also $$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\nSince everything is streamed, there is no copy of the vector of ghost coordinates.\n\n# Code\n```\nimpl Solution {\n  pub fn escape_ghosts(ghosts: Vec<Vec<i32>>, target: Vec<i32>) -> bool {\n    let x = target.get( 0).unwrap();\n    let y = target.get( 1).unwrap();\n    let my_dist = x.abs() + y.abs();\n    let ghost_dist = ghosts.iter().map( \n        |g| (g.get( 0 ).unwrap() - x).abs()\n            + (g.get( 1 ).unwrap() - y).abs()\n      ).min().unwrap();\n    my_dist < ghost_dist\n  }\n}\n```
['Rust']