Lowest-Latency Origin Route Within an Egress Cost Budget
Last updated: November 29, 2026
Quick Overview
Given a directed network of data centers and caches where each link has a latency and an integer egress cost, find the minimum total latency path from a source to a destination whose total cost does not exceed a budget, returning the latency and the path.
Netflix
November 29, 20260
0
0 solved
Given a directed network of data centers and caches where each link has a latency and an integer egress cost, find the minimum total latency path from a source to a destination whose total cost does not exceed a budget, returning the latency and the path.
Netflix fills its Open Connect caches from origin storage across cloud regions and peering links, and moving bytes has both a latency and a dollar cost. Plain Dijkstra fails here because the cheapest-latency path may break the budget, so the interviewer is checking whether a candidate can extend the state and prune dominated labels correctly.
What the Interviewer Expects
- Explain why standard Dijkstra on latency alone is wrong with a budget
- Search over states (node, cost so far) ordered by latency
- Prune labels dominated in both latency and cost
- Return the first time the destination is popped
- Discuss complexity in terms of budget, and alternatives like Lagrangian relaxation
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you change this to minimize cost subject to a latency SLO?
- If budgets are large real numbers, how would you approximate?
- How would you precompute routes for many destinations at once?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Nodes 0..n-1, directed links (u, v, latency, cost), non-negative values, integer costs. Find a path src -> dst with sum(cost) <= budget minimizing sum(latency). Return (latency, path) or None if no fe...
High-Level Design
Run Dijkstra where a heap entry is a label (latency, cost, node, path). Because entries are popped in latency order, any label settled earlier at the same node has latency <= the current one; if it al...