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.
on theory if (x1 - x2) % (v2 - v1) == 0 is good, if v2-v1 equal to one will fail, and if condition is
if (v1 == v2 && x1 != x2) or (x2 > x1 && v2 > v1) or (x1 > x2 && v1 > v2) then don't need waste time calculate it, the answer will be no
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 →
on theory if (x1 - x2) % (v2 - v1) == 0 is good, if v2-v1 equal to one will fail, and if condition is if (v1 == v2 && x1 != x2) or (x2 > x1 && v2 > v1) or (x1 > x2 && v1 > v2) then don't need waste time calculate it, the answer will be no