Earliest Completion and Critical Path for Agreement Approval Workflows

Last updated: November 29, 2026

Quick Overview

An agreement workflow has steps (legal review, finance approval, signer actions) with expected durations in hours and dependency edges between them. Compute the earliest time the whole workflow can finish if independent steps run in parallel, return one critical path, and report an error if the dependencies contain a cycle.

DocuSign
Coding & Algorithms
Software Engineer
DocuSign
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


An agreement workflow has steps (legal review, finance approval, signer actions) with expected durations in hours and dependency edges between them. Compute the earliest time the whole workflow can finish if independent steps run in parallel, return one critical path, and report an error if the dependencies contain a cycle.

DocuSign Maestro and CLM let customers build multi-step agreement workflows, and a builder needs to reject cyclic configurations and estimate turnaround. This onsite question checks topological sorting, longest path in a DAG, path reconstruction, and clean cycle reporting.

What the Interviewer Expects
  • Recognise the problem as longest path in a DAG, which is easy only because the graph is acyclic
  • Use Kahn's algorithm so cycle detection comes for free
  • Track a parent pointer for each node to reconstruct the critical path
  • Report which steps are stuck in or behind the cycle
  • Handle zero-duration steps and multiple start or end steps
Key Topics to Cover
Topological sort
DAG longest path
Cycle detection
Path reconstruction
Scheduling
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 update the answer incrementally when one step's duration changes?
  • Steps have uncertain durations. How would you estimate a P90 completion time?
  • Some edges are conditional (finance only if amount over a threshold). How does the model change?
  • How would you list every step with zero slack, not just one path?
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: durations mapping step to non-negative hours and deps as (before, after) pairs. A step starts when all predecessors finish; independent steps run in parallel. Output: total hours and one ...

High-Level Design

Earliest finish of a step is its duration plus the max earliest finish over its predecessors. Processing in topological order guarantees predecessors are final before use. Kahn's algorithm gives that ...


Submit Your Answer
Markdown supported

Related Questions