Order Accounting Sync Jobs Into Parallel Waves by Dependency
Last updated: November 29, 2026
Quick Overview
Before Ramp pushes card transactions into a customer's ERP, reference data (accounts, vendors, classes) must sync first. Given jobs and before/after dependencies, return waves of jobs that can run in parallel, or report the jobs stuck in a cycle.
Ramp
November 29, 20260
0
0 solved
Before Ramp pushes card transactions into a customer's ERP, reference data (accounts, vendors, classes) must sync first. Given jobs and before/after dependencies, return waves of jobs that can run in parallel, or report the jobs stuck in a cycle.
Ramp's accounting integrations (NetSuite, QuickBooks, Xero and others) have ordering constraints: a bill cannot reference a vendor that does not exist yet in the ERP. The interviewer is looking for Kahn's algorithm, level-by-level output for parallelism, deterministic ordering, and a useful error on cycles.
What the Interviewer Expects
- Builds an adjacency list and in-degree map
- Processes zero in-degree jobs level by level to produce parallel waves
- Sorts within a wave so output is deterministic and testable
- Detects cycles by counting processed jobs and reports which ones are stuck
- Validates dependencies that reference unknown jobs
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 minimize total wall time if jobs have different durations?
- How do you cap a wave at N concurrent jobs because of ERP rate limits?
- If one job in wave 1 fails, which later jobs must be skipped?
- How would you find and print one actual cycle path?
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 list of job names and (before, after) pairs. Output: a list of waves, each a sorted list, such that every job's prerequisites are in strictly earlier waves. If no valid order exists, raise ...
High-Level Design
This is a topological sort where I keep the BFS frontier grouped by level. Start with every job of in-degree zero as wave one. Processing a wave decrements each child's in-degree; children that reach ...