Skip to main content
All Questions

Determine whether a message can reach a destination router from a source router.

Unlock detailed company stats for this questionUpgrade

You are given a list of routers with their 2D location coordinates, a source router, a destination router and a range value. Each router that receives a message broadcasts it to the other routers in range, and whenever a router broadcasts a message it shuts down permanently. Distance between routers is Euclidean distance. Write a method that determines whether a message starting at the source router can reach the destination router.

Example: router A at (0, 0), B at (0, 8), C at (0, 17), D at (11, 0), range 10, source A, destination D. A's message reaches B, B's message reaches C, but D never receives it.

Expect follow-ups like

  • How would you update the solution if messages that arrive at the destination at the same time collide and are discarded, assuming travel time is proportional to distance?

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.