Google Interview Coding Question: Wireless Message Reachability in a Router Network

18 Views
No Comments

Network of routers: each router has an (x, y) coordinate.

A message can be broadcast from one router to another if the Euclidean distance between them is within wireless range.

Given a source router and a destination router, determine whether the message will reach the destination from the source.

Example:

A(0, 0), B(0, 8), C(0, 17), D(11, 0)
Wireless range = 10
Start = A

In this example, A can send a message to B, but cannot directly send to C or D.

This problem asks whether a message can travel from a source router to a destination router in a 2D network, where routers connect if their Euclidean distance is within the wireless range. The natural solution is to model routers as graph nodes and use BFS or DFS to test reachability. If broadcasting causes routers to shut down, the traversal order and visited-state handling become important. The key ideas are graph construction, distance checks, and connectivity search.

END
 0