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.
defkangaroo(x1,v1,x2,v2):# Write your code hereifv1<=v2:return"NO"ifv1%v2==0and(x2%x1==0):return"YES"n_steps=(x2-x1)/(v1-v2)ifn_steps%1==0:return"YES"return"NO"
Number Line Jumps
You are viewing a single comment's thread. Return to all comments →
Python: O(1) solution