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.
functionkangaroo(x1,v1,x2,v2){// Write your code here// constraint given x2 >x1letdist=x2-x1;while(dist>0){x1+=v1;x2+=v2;if(x1===x2)return'YES';elseif((x2-x1)>=dist)return'NO';elsedist=x2-x1;}return'NO';}
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 →
This is my code in js: