Compute Safe Import Order for Transport Requests Across Systems
Last updated: November 29, 2026
Quick Overview
Each transport request has a release timestamp, and some transports require others to be imported first. Return an import order that respects every prerequisite, picking the earliest released transport whenever several are ready, or report the transports that are blocked by a dependency cycle.
SAP
November 29, 20260
0
0 solved
Each transport request has a release timestamp, and some transports require others to be imported first. Return an import order that respects every prerequisite, picking the earliest released transport whenever several are ready, or report the transports that are blocked by a dependency cycle.
SAP teams that build lifecycle tooling (Change and Transport System, Cloud ALM) like this question because shipping changes from DEV to QAS to PRD in the wrong order breaks production systems. The interviewer looks for Kahn's algorithm with a priority queue and a clear story for cycles and bad input.
What the Interviewer Expects
- Models transports as a directed graph from prerequisite to dependent
- Uses Kahn's algorithm so cycles are detected naturally
- Uses a min-heap keyed by release time for the tie-break rule
- Reports which transports are blocked instead of silently returning a partial order
- Validates references to unknown transports
- Gives O((V + E) log V) complexity
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 report the actual cycle path rather than every blocked transport?
- Some transports are already imported in the target system; how does that change the graph?
- How would you split the order into parallel import waves?
- What if a prerequisite lives in a different import queue (another target system)?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a map transport_id -> release_ts and a list of (transport, prerequisite) pairs. Output: an order in which every prerequisite comes before its dependent. When several transports are ready, i...
High-Level Design
Build edges prerequisite -> transport and count in-degrees. Every transport with in-degree zero is ready and goes into a min-heap keyed by (release_ts, id). Pop the earliest, append it to the orde...