Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
453 B
3
Indexable
Never
class Solution(object):
    def isReachableAtTime(self, sx, sy, fx, fy, t):
        maxAdjWalk = 0
        maxAdjWalk = min(abs(fx-sx),abs(fy-sy))
        totalT = maxAdjWalk + (abs(abs(fx)-abs(sx))-maxAdjWalk) + (abs(abs(fy)-abs(sy))-maxAdjWalk)
        if totalT==0:
            if t==0:
                return True
            if t ==1 :
                return False
        if totalT>t:
            return False
        else:
            return True