Earliest Arrival Across Places Linked by Timed Server Gates
Last updated: November 29, 2026
Quick Overview
A universe of connected places is linked by one-way gates; each gate from u to v departs only at times offset + k * period and takes a fixed travel time. Starting at place src at time t0, return the earliest time you can reach dst, or -1.
Roblox
November 29, 20260
0
0 solved
A universe of connected places is linked by one-way gates; each gate from u to v departs only at times offset + k * period and takes a fixed travel time. Starting at place src at time t0, return the earliest time you can reach dst, or -1.
Roblox experiences often span multiple places connected by teleports, and scheduled transitions make this a time-dependent shortest path problem. The interviewer checks whether you see that waiting preserves the FIFO property so Dijkstra still works, and whether the ceil arithmetic is right.
What the Interviewer Expects
- Model it as a time-dependent graph
- Compute next departure with correct ceiling division
- Argue why Dijkstra stays correct (FIFO, no benefit from arriving later)
- Skip stale heap entries
- Handle unreachable targets and start times after offsets
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
- What if some gates have a capacity and can be full?
- How would you answer many queries for different start times?
- What breaks if travel time depends on departure time in a non-FIFO way?
- How would you return the full itinerary?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Gates are (u, v, travel, period, offset). If you are at u at time t, the next departure is the smallest offset + k*period >= t with k >= 0, and you arrive at depart + travel. Waiting at a ...
High-Level Design
Treat the label of each node as earliest arrival time. Edge cost depends on when you get there, but arriving earlier at u never makes you arrive later at v (you could always wait). This FIFO prope...