Resolve Compute Order for a Dependent Feature Pipeline
Last updated: November 29, 2026
Quick Overview
Given a mapping from each derived feature to the features it depends on, return an order in which all features can be computed, or raise an error naming the features stuck in a cycle.
Voleon
November 29, 20260
0
0 solved
Given a mapping from each derived feature to the features it depends on, return an order in which all features can be computed, or raise an error naming the features stuck in a cycle.
Voleon's research platform computes thousands of derived signals from raw market data every night, and the dependency graph between them must be ordered and validated. Interviewers use this to see whether you recognize topological sort, include nodes that appear only as dependencies, and give a useful cycle error rather than a silent partial result.
What the Interviewer Expects
- Model features as a directed graph from dependency to dependent
- Include raw inputs that appear only on the right-hand side
- Use Kahn's algorithm with in-degrees
- Detect cycles when not every node is emitted and report them
- Make output deterministic for reproducible research runs
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 recompute only the features downstream of a changed input?
- How would you schedule independent features in parallel on a fixed number of workers?
- How would you find one actual cycle path to show the user?
- What changes if some features depend on yesterday's value of themselves?
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: dict[str, list[str]], for example zscore -> [ret_5d, vol_20d]. Output: a list where every feature appears after all of its dependencies. Raw columns like close are nodes too. A cycle is a...
High-Level Design
Build edges dependency -> feature and compute each node's in-degree. Nodes with in-degree zero (raw inputs) are ready. Repeatedly pop a ready node, append it, and decrement the in-degree of its chil...