Latency From Every Node to Its Nearest Edge PoP

Last updated: November 29, 2026

Quick Overview

Given a weighted undirected network and a set of nodes that host points of presence, compute for every node the latency to its closest PoP and which PoP that is. Break ties by the smaller PoP id.

Meta
Coding & Algorithms
Software Engineer
Meta
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given a weighted undirected network and a set of nodes that host points of presence, compute for every node the latency to its closest PoP and which PoP that is. Break ties by the smaller PoP id.

Meta routes user traffic to the nearest edge PoP, so assigning nodes to their closest PoP is a realistic Meta screen problem. It checks whether you know multi-source Dijkstra instead of running Dijkstra once per PoP. Clean tie-breaking also shows care.

What the Interviewer Expects
  • Seed the heap with every PoP at distance 0
  • Explain why this equals Dijkstra from a virtual super source
  • Track the owning PoP alongside the distance
  • Apply the tie-break consistently during relaxation
  • Report unreachable nodes
Key Topics to Cover
Multi-source Dijkstra
Super source
Weighted graphs
Tie-breaking
Heap
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you update assignments when one PoP goes offline?
  • How does this relate to a Voronoi partition of a graph?
  • What if each PoP has a capacity limit?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • n up to 10^5, links up to 2 * 10^5 with positive latency, a nonempty PoP list.
  • Output for each node: (latency, pop_id), or (-1, -1) if no PoP is reachable....
High-Level Design

Add a virtual source connected to every PoP with weight 0 and run Dijkstra once. Equivalently, push every PoP into the heap at distance 0. Each node is settled by the PoP whose region expands to it fi...


Submit Your Answer
Markdown supported