Skip to content

Commit 70fd411

Browse files
committed
Time: 8 ms (43.18%), Space: 10.5 MB (35.23%) - LeetHub
1 parent 6030747 commit 70fd411

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution {
2+
public:
3+
bool escapeGhosts(vector<vector<int>>& ghosts, vector<int>& target) {
4+
int md = 0;
5+
6+
int tx = target[0];
7+
int ty = target[1];
8+
9+
int stt = abs(tx) + abs(ty);
10+
11+
for(auto g: ghosts){
12+
if((abs(tx - g[0]) + abs(ty - g[1])) <= stt)
13+
return false;
14+
}
15+
16+
return true;
17+
}
18+
};

0 commit comments

Comments
 (0)