Question: You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the
You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the program is important so it is best to use an algorithm in the code which will not timeout


Number Line Jumps Problem Submissions Leaderboard Discussions Fin You are choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump in the positive direction (i.e, toward positive infinity) Contest ends in 7 days The first kangaroo starts at location zl and moves at a rate of vl meters per jump. The second kangaroo starts at location 22 and moves at a rate of 12 meters per jump. Submissions: 0 Max Score: 10 Difficulty: Easy Rate This Challenges You have to figure out a way to get both kangaroos at the same location at the same time as part of the show. If it is possible, return YES, otherwise return NO. More For example, kangaroo 1 starts at al = 2 with a jump distance ol = 1 and kangaroo 2 starts at x2 = 1 with a jump distance of v2 = 2. After one jump, they are both at I = 3, (21+ v1 = 2+1, 2+2 = 1+2), so our answer is YES. Function Description Complete the function kangaroo in the editor below. It should return YES if they reach the same position at the same time, or No if they don't. kangaroo has the following parameter(s): x1, vi: integers, starting position and jump distance for kangaroo 1 x2, v2.integers, starting position and jump distance for kangaroo 2 Input Format A single line of four space-separated integers denoting the respective values of x1, v1, 22, and v2. Constraints . 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
