2849. Determine if a Cell Is Reachable at a Given Time¶ Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7class Solution { public: bool isReachableAtTime(int sx, int sy, int fx, int fy, int t) { const int minStep = max(abs(sx - fx), abs(sy - fy)); return minStep == 0 ? t != 1 : minStep <= t; } }; 1 2 3 4 5 6class Solution { public boolean isReachableAtTime(int sx, int sy, int fx, int fy, int t) { final int minStep = Math.max(Math.abs(sx - fx), Math.abs(sy - fy)); return minStep == 0 ? t != 1 : minStep <= t; } } 1 2 3 4 5 6 7 8 9 10 11class Solution: def isReachableAtTime( self, sx: int, sy: int, fx: int, fy: int, t: int, ) -> bool: minStep = max(abs(sx - fx), abs(sy - fy)) return t != 1 if minStep == 0 else minStep <= t