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
Coding & Algorithms
Software Engineer
SAP
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

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
topological sort
Kahn's algorithm
priority queue
cycle detection
dependency management
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 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 Problems
Sample 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...


Submit Your Answer
Markdown supported

Related Questions