Skip to content

Commit

Permalink
Create 2849. Determine if a Cell Is Reachable at a Given Time (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chayandas07 authored Nov 8, 2023
2 parents 280576c + 4f3ca02 commit b24ed76
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 2849. Determine if a Cell Is Reachable at a Given Time
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public:
bool isReachableAtTime(int sx, int sy, int fx, int fy, int t) {
if(sx == fx && sy == fy){
if(t==1)return false;
return true;
}
int x = abs(sx-fx),y = abs(sy-fy);
if(max(x,y)>t){
return false;
}
return true;
}
};

0 comments on commit b24ed76

Please sign in to comment.