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.
bool diff;
string out = "NO";
for(int x = 0; x < MAX; x++){
diff = ((v1*x+x1)-(v2*x+x2)) == 0;
//cout << ((v1*x+x1)-(v2*x+x2)) << endl;
if(diff){
out = "YES";
break;
}
}
return out;
here is another way to do it, MAX is 10000 since it will never go above that.
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 →