You are viewing a single comment's thread. Return to all comments →
Check (v2 < v1) instead of (x2 - x1) * (v2 - v1) < 0 because (x2 - x1) is always greater than zero (given in constraints). Thus;
System.out.println((v2 < v1 && (x2 - x1) % (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 →
Check (v2 < v1) instead of (x2 - x1) * (v2 - v1) < 0 because (x2 - x1) is always greater than zero (given in constraints). Thus;