You are viewing a single comment's thread. Return to all comments →
Need to however catch the the case where v2 > v1:
function kangaroo(x1, v1, x2, v2) { // x1 + y.v1 = x2 + y.v2 // y = (x2 - x1) / (v1 - v2) // YES if (x2 - x1) % (v1 - v2) == 0 if (v1 < v2) return 'NO' // impossible catch up if (((x2 - x1) % (v1 - v2)) == 0) return 'YES' return 'NO' }
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 →
Need to however catch the the case where v2 > v1: