• + 1 comment

    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"