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.
char*kangaroo(intx1,intv1,intx2,intv2){char*s=malloc(10*sizeof(char));intrelativeSpeed;//if speed of kangaroo 1 is slower or equal to kangaroo 2, they will never meetif(v1<=v2){s="NO";}else{//finding relative speedrelativeSpeed=x2-x1;//If relativeSpeed % (v1 - v2) == 0, then the kangaroos will meet at some future time.if(relativeSpeed%(v1-v2)==0){s="YES";}else{s="NO";}}returns;free(s);}
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 →
Solution in C