DEV Community

Discussion on: How important is math in computer programming?

Collapse
 
sreeprasad profile image
Sreeprasad

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.

Collapse
 
kalkwst profile image
Kostas Kalafatis

The requirement is to land on the same point at the same time ;)