Group Feature Resolvers Into Parallel Execution Stages

Last updated: November 29, 2026

Quick Overview

Given resolvers that each read some features and produce others, return the resolvers grouped into stages so that every stage depends only on earlier stages and resolvers within a stage can run in parallel. Report a clear error on a dependency cycle or when two resolvers produce the same feature.

Chalk
Coding & Algorithms
Software Engineer
Chalk
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given resolvers that each read some features and produce others, return the resolvers grouped into stages so that every stage depends only on earlier stages and resolvers within a stage can run in parallel. Report a clear error on a dependency cycle or when two resolvers produce the same feature.

Chalk turns Python resolvers into a query plan, and the engine runs independent resolvers concurrently to keep online queries in single-digit milliseconds. The interviewer wants to see you derive the resolver graph from feature inputs and outputs, then layer it with Kahn's algorithm rather than just produce one linear order.

What the Interviewer Expects
  • Builds the graph between resolvers from feature producers, not between features directly
  • Uses Kahn's algorithm level by level to produce parallel stages
  • Detects cycles by comparing processed count with resolver count and names the stuck resolvers
  • Rejects a feature produced by two resolvers instead of silently picking one
  • Treats features with no producer as caller-supplied inputs
  • States O(R + E) complexity
Key Topics to Cover
topological sort
Kahn's algorithm
DAG layering
cycle detection
query planning
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 change the output if stages should minimize the critical path by resolver latency rather than by count?
  • Two resolvers can legitimately produce the same feature for different sources (for example cache and database). How would you model priority?
  • How would you report the exact cycle path rather than the set of stuck resolvers?
  • How would you schedule if each stage had a concurrency limit?
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: name -> (inputs, outputs) where inputs and outputs are fully qualified feature names like user.email. Output: a list of stages, each a sorted list of resolver names. A feature nobody produc...

High-Level Design
  1. Map each feature to its single producer.
  2. For each resolver, every input with a producer becomes an edge producer -> resolver. Use sets so a resolver reading two outputs of the same producer co...

Submit Your Answer
Markdown supported

Related Questions