You are viewing a single comment's thread. Return to all comments →
really nice solution . and i have made a slight modification as well to your solution to pass all the test cases.
def kangaroo(x1, v1, x2, v2): #k1=0,k2=0 try: if x2>x1 and v2>v1: return "NO" elif abs((x1-x2) % (v1-v2)) == 0 and v1!=v2: return "YES" else: return "NO" except: 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 →
really nice solution . and i have made a slight modification as well to your solution to pass all the test cases.
def kangaroo(x1, v1, x2, v2): #k1=0,k2=0 try: if x2>x1 and v2>v1: return "NO" elif abs((x1-x2) % (v1-v2)) == 0 and v1!=v2: return "YES" else: return "NO" except: return "NO"