Number Line Jumps

  • + 0 comments

    Thought about as just intersecting lines.

    def kangaroo(x1, v1, x2, v2):
        if v2 >= v1:
            return "NO"
        xint = (x2 - x1) / (v1 - v2)
        if xint % 1 != 0:
            return "NO"
        return "YES"