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.
v1 should be greater than v2 so that 2 animals can land at the same time.Hence check for v1-v2 first to avoid divide by zero exception. Then check if((x2-x2)%(v1-v2)) == 0 return yes else return 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 →
v1 should be greater than v2 so that 2 animals can land at the same time.Hence check for v1-v2 first to avoid divide by zero exception. Then check if((x2-x2)%(v1-v2)) == 0 return yes else return no