Amazon | Phone Screen | Elevator, buttons and floor
Anonymous User
2554

Elevator has two buttons Up and Down , By pressing up elevator goes up by p floors and by pressing down it goes down by q floors. A building has n floors. Given a starting floor s, Can you explain if it's possible to go to floor e.

I was able to come up with recursive solution in the given time frame. Interviewer wanted a more optimized solution.

Comments (9)