We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
For this problem, we basically have the solve for the number of jumps.
Equation: X1 + ( V1* j ) = X2 + (V1 * j)
They equal because they will end up in the same landing spot with the same amount of jumps.
From here on out, simply solve for j.
*hint - Things to look out for - both kangaroos are in the same spot with the same speed - different spot with the same speed. - If (x1 < x2) && (v1 < v2) - what happens when x1 is far behind and its speed rate (v1) is slower than v2?
Cookie support is required to access HackerRank
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 →
For this problem, we basically have the solve for the number of jumps.
Equation: X1 + ( V1* j ) = X2 + (V1 * j)
They equal because they will end up in the same landing spot with the same amount of jumps.
From here on out, simply solve for j.
*hint - Things to look out for - both kangaroos are in the same spot with the same speed - different spot with the same speed. - If (x1 < x2) && (v1 < v2) - what happens when x1 is far behind and its speed rate (v1) is slower than v2?