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.
- Number Line Jumps
- Discussions
Number Line Jumps
Number Line Jumps
Sort by
recency
|
115 Discussions
|
Please Login in order to post a comment
def kangaroo(x1, v1, x2, v2): for i in range(1,10000): x1+=v1 x2+=v2 if x1==x2: return "YES" return "NO"
Two solution in python #Python
I was having trouble understanding the posted python answers, so here's mine. Was easier for me to understand at least.
def kangaroo(x1, v1, x2, v2): while True: # start position + hop distance x1 += v1 x2 += v2
Misleading question. What they're searching for is an integer time where both Kangaroos meet, but the question doesn't imply that.