Fastest Workflow Path That Visits Every Required Checkpoint
Last updated: November 29, 2026
Quick Overview
An agent workflow is a directed graph of states with latency weights on edges. Find the minimum total latency from a start state to a goal state that passes through every state in a small required set (at most 10), or return -1 if impossible.
Sierra
November 29, 20260
0
0 solved
An agent workflow is a directed graph of states with latency weights on edges. Find the minimum total latency from a start state to a goal state that passes through every state in a small required set (at most 10), or return -1 if impossible.
Customer-service agents at Sierra must pass policy checkpoints, such as identity verification and disclosure, before sensitive actions like a refund. This question checks whether you can extend Dijkstra with bitmask state and reason about the resulting state space.
What the Interviewer Expects
- Recognize plain shortest path ignores the checkpoint requirement
- Augment state to (node, visited mask)
- Run Dijkstra over the product graph with lazy deletion
- Handle the start node itself being a checkpoint
- Bound complexity in terms of 2^k
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
- What if checkpoints must be visited in a specific partial order?
- How would you return the actual path, not just the latency?
- If k grows to 30, what would you do instead?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
States are 0..n-1, edges are directed (u, v, ms) with non-negative weights. Required states are at most 10 distinct ids. The path may revisit states. Return the minimum latency to reach goal wit...
High-Level Design
The answer depends on where we are and which checkpoints we have passed, so expand each node into 2^k copies, one per mask. An edge u -> v in the original graph becomes `(u, mask) -> (v, mask | bi...