You are viewing a single comment's thread. Return to all comments →
def kangaroo(x1, v1, x2, v2): isTrue = False limit,K1,K2 =0,0,0 K1 = (x1+v1) K2 = (x2+v2) while True: if K1 == K2: isTrue = True break K1 +=v1 K2 +=v2 if limit==10000: break limit +=1 if isTrue: return "YES" else: return "NO"
Seems like cookies are disabled on this browser, please enable them to open this website
Number Line Jumps
You are viewing a single comment's thread. Return to all comments →
def kangaroo(x1, v1, x2, v2): isTrue = False limit,K1,K2 =0,0,0 K1 = (x1+v1) K2 = (x2+v2) while True: if K1 == K2: isTrue = True break K1 +=v1 K2 +=v2 if limit==10000: break limit +=1 if isTrue: return "YES" else: return "NO"