FAANG | Phone screen | Path forward through obstacles
Anonymous User
2516

I recently had a technical interview over the phone with a FAANG company and they asked this question. I'd be very happy if someone could help me solve it as it's taken me all weekend to try and figure it out.


Imagine a robot vaccum that needs to travel through a room from one end to the other (the robot starts at y = 0). There are multiple obstacles along the way. Can the vacuum get across?

Data points
Vacuum diameter: int 3
Obstacle diameter: int 1
Room width: 0 < x > 20
Room length: 0 < y > 50
Obstacle position: float x, y

Input: [[x, y], [x, y], [x, y]...]
Output: True/False

Write a function that takes in a list of obstacle positions and determine if the vacuum can get across or not.


Really looking forward to hearing your take.

Thanks!

Comments (8)