Please correct me if I am wrong but won't your answer print "No" for the following input (0,12,4,2). Here x1 = 0, v1 = 12 and x2=4 and v2=2.
First Kangaroo x1 reaches 12 in 1 step & second Kangaroo reaches 12 in 4 steps.
But your solution will print "No".
I guess the question is should the both take the same number of steps to reach the common point.
The requirement is to land on the same point at the same time ;)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Please correct me if I am wrong but won't your answer print "No" for the following input (0,12,4,2).
Here x1 = 0, v1 = 12 and x2=4 and v2=2.
First Kangaroo x1 reaches 12 in 1 step & second Kangaroo reaches 12 in 4 steps.
But your solution will print "No".
I guess the question is should the both take the same number of steps to reach the common point.
The requirement is to land on the same point at the same time ;)