Untitled
user_1208626
java
a year ago
466 B
5
Indexable
class Solution {
public boolean isReachableAtTime(int sx, int sy, int fx, int fy, int t) {
if (sx == fx && sy == fy) {
return t != 1;
}
//make sure (sx, sy) is above (or inline) and left (or inline) to (fx,fy)
if (sx > fx) {
fx = sx + sx - fx;
}
if (sy > fy) {
fy = sy + sy - fy;
}
return t >= Math.max(fx - sx, fy - sy);
}
}Editor is loading...
Leave a Comment