Google·Machine Learning Engineer·Technical Phone Screen
- You have an unordered set of coordinate points, a start, an end, and a function getDistance(x, y). Two points are directly connected if their distance is less than r. Can the start point reach the end point, possibly through intermediate hops?
- Follow-up: if the number of points is very large and computing all pairwise distances is too slow, how would you optimize?
“Jumped to BFS pretty fast which felt right, model it as a graph where edges exist when getDistance returns something under r.”