Quora Phone Screen: Given a pair of integers, min # operations to reach target
Anonymous User
2413

Given a pair of numbers (A, B), you can perform an operation (A+B, B) or (A, A+B). (A, B) is initialized to (1,1).

Given an N>0, find the minimum number of operations needed to perform on (A, B) until A=N or B=N.
Additionally, give the time complexity of the solution.

I'm really confused on the best approach here, can anyone give any help?

Comments (7)