You are viewing a single comment's thread. Return to all comments →
String NO = "NO"; String YES = "YES"; boolean faster = (x1 >= x2 && v1 > v2) || (x2 >= x1 && v2 > v1); boolean late = (v1 == v2 && x2 > x1) || (v1 == v2 && x1 > x2); if(faster || late ) return NO; if(x2 > x1) { return ((x2 - x1) % (v1 - v2) == 0) ? YES : NO; } else { return ((x1 - x2) % (v2 - v1) == 0) ? YES : 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 →