Cure.fit | SDE | 25 November

curefit · Question · Posted Apr 2020

A cat named Minerva is playing a game in the coordinate plane. She starts at (1,1) and can move by either doubling one of x, y or subtracting the greater one from the smaller { (4,1)->(3,1)}. You're given a point (x, y). Will she be able to reach the point? Output YES or NO. 0<= x,y<=3000000000 input: (3,4) Output: YES Explanation: (1,1)->(2,1)->(4,1)->(3,1)->(3,2)->(3,4)

The full answer & interview discussion are available to premium members.

Log in Create a free account