Question: In python. Suppose you are in a grid map at starting location (start_x, start_y) and you wish to go to a certain location (end_x, end_y)

In python. Suppose you are in a grid map at starting location(start_x, start_y) and you wish to go to a certain location (end_x,In python.

Suppose you are in a grid map at starting location (start_x, start_y) and you wish to go to a certain location (end_x, end_y) to visit your relatives. Due to some strange Chinese New Year auspicious algorithm, the only way you can travel is the following: (a, b)-> (a + b, b) OR (a, b)-> (a, a + b) This means that if you start at (1,3), the next place you can go is (4,3) or (1, 4). However you can repeat this action for as many times as required until you reach your relative. Case 1 Suppose you start at (1, 3), and your relative is staying at (4,7), (1,3) can go to (4,3) which can go to (4,7) Case 2 Suppose you start at (1, 3), and your relative is staying at (4,4), (1,3) can go to (4,3) or (1,4). (4,3) can go to (7,3) or (4,7) (1,4) can go to (5, 4) or (1,5) Suppose you start at (1,3), and your relative is staying at (4,4), (1,3) can go to (4,3) or (1,4). (4,3) can go to (7,3) or (4,7) (1,4) can go to (5, 4) or (1,5) (7,3) can go to (10,3) or (7, 10) You will realize that you will not be able to reach your relative. Task You will be given four numbers, the first two numbers are the starting locations and the next two the ending locations. Your task is to return True if you can reach your relatives home, and False if you cannot. Hint: use recursion. Input Format x location of start y location of start x location of end y location of end 1459 Constraints All positive numbers Output Format True or False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!