Order Invoked Workflow Files and Report Invocation Cycles
Last updated: November 29, 2026
Quick Overview
A Studio project is a set of workflow files where each file can invoke others. Given a map from file to the files it invokes and an entry point, return every reachable file ordered so each appears after everything it invokes, or raise an error that names the exact cycle path.
UiPath
November 29, 20260
0
0 solved
A Studio project is a set of workflow files where each file can invoke others. Given a map from file to the files it invokes and an entry point, return every reachable file ordered so each appears after everything it invokes, or raise an error that names the exact cycle path.
Studio analyzes projects before publishing (workflow analyzer rules, unused file detection, packaging), and an Invoke Workflow File loop is a real bug users hit. The interviewer wants a correct DFS topological sort with three-color cycle detection and a helpful error, not just a boolean.
What the Interviewer Expects
- Recognizes topological sort on a directed graph limited to nodes reachable from the entry
- Uses white, gray, black states to detect back edges
- Reports the cycle as a path, not just 'cycle found'
- Handles files invoked by several parents only once
- Discusses recursion depth and offers an iterative version
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 list unreachable files so the analyzer can flag them as unused?
- Invocations can be dynamic (file name from a variable). How does that change the guarantee?
- How would you compute which workflows must be re-tested after one file changes?
- Extend this to package dependencies with version ranges. What new problem appears?
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: invokes: dict[str, list[str]] and entry. Files missing from the dict invoke nothing. Output: reachable files in post-order (dependencies first). A cycle raises CycleError with a path like...
High-Level Design
DFS from the entry. Mark a file gray when entered and black when all its callees are finished. Seeing a gray node means a back edge, which is a cycle; the current DFS stack from that node to the top i...