Reported October 2026
Hadriangraph

Work Order Critical Path

Reported by candidates from Hadrian's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Hadrian OA. Under 2s to a working solution.
Founder's read

The Hadrian OA reported in October 2026 hands you a work order DAG and asks for the longest path ending at shipping. It reads like a story problem, but it's a graph problem with a couple of traps. The operation types are noise, and the dependency lists are keyed by string IDs, not indexes. If you've got an invite for this one, the pattern is longest path in a DAG with memoized DFS or topological order. StealthCoder is the safety net if you blank during the live OA, but the core idea fits in ten lines.

The problem

A work order contains operations in a directed acyclic graph. Each operation has a unique identifier, a type label, and a positive duration in days. dependencies[i] lists the operation identifiers that must finish before operationIds[i] can start.
Every maximal dependency path ends at the operation named by shippingId. Return the maximum total duration along any dependency path that ends at shipping, including the shipping operation itself.
The type labels are descriptive metadata and do not change scheduling behavior.

Function
criticalPathDuration(operationIds: String[], operationTypes: String[], dependencies: String[][], durations: int[], shippingId: String) → int

Examples
Example 1
operationIds = ["cut","paint","inspect","ship"]
operationTypes = ["FAB","FINISH","QA","SHIP"]
dependencies = [[],["cut"],["paint"],["inspect"]]
durations = [2,4,1,1]
shippingId = "ship"
return = 8
The only path to shipping lasts 2 + 4 + 1 + 1 = 8 days.
Example 2
operationIds = ["a","b","c","ship"]
operationTypes = ["FAB","FAB","QA","SHIP"]
dependencies = [[],[],["a"],["b","c"]]
durations = [5,9,3,2]
shippingId = "ship"
return = 11
The branch b to ship lasts 11 days, longer than the a-to-c branch at 10 days.

Constraints
1 <= operationIds.length == operationTypes.length == dependencies.length == durations.length <= 500.
Operation identifiers are unique nonempty ASCII strings, and shippingId names one operation.
Every dependency names another operation, the graph is acyclic, and every maximal path ends at shipping.
1 <= durations[i] <= 100000; the answer fits a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: longest path to node X equals duration[X] plus the max of the longest paths to its dependencies. Nodes with no dependencies just return their own duration. Memoize that with DFS from shippingId, or run Kahn's algorithm and propagate finish times. Either is O(V+E) with at most 500 nodes. The pitfall that breaks naive solutions is treating it as a tree and recomputing shared dependencies, which blows up exponentially on diamond shapes. Second pitfall: mapping string IDs to indexes wrong, or using the operationTypes for something. They're ignored. Third: forgetting to add the shipping duration itself. Check Example 2 by hand: max(9, 5+3) + 2 = 11. If you freeze on the live OA, StealthCoder runs invisibly and can hand you the memoized DFS, but you should be able to write it yourself.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Work Order Critical Path cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Hadrian's OA.

Hadrian reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Work Order Critical Path FAQ

What's the trick in the Hadrian Work Order Critical Path problem?+

Longest path in a DAG. For each operation, finish time equals its duration plus the max finish time among its dependencies. Memoize by operation ID, start from shippingId, and return the result. Operation types are metadata and never affect the math.

Do I need topological sort or is DFS enough?+

DFS with a memo map is enough and shorter to write. The graph is guaranteed acyclic, so you don't need cycle detection. With at most 500 operations, recursion depth is safe. Kahn's algorithm also works if you prefer iterative code.

Why does my solution time out or give wrong answers on shared dependencies?+

You're likely recomputing the same node through multiple paths without caching. Diamond-shaped graphs make that exponential. Store each operation's longest finish time in a hash map the first time you compute it, then reuse it.

How hard is this really?+

Medium at most. It's a standard DAG longest path with string-keyed nodes. The difficulty is setup: building the ID-to-index or ID-to-dependencies map cleanly and not getting distracted by the unused type labels.

How do I prepare for this in 48 hours?+

Write longest path in a DAG twice from scratch, once with memoized DFS and once with Kahn's. Then trace both examples by hand. Practice edge cases: a single operation that is shipping, and multiple roots feeding one node.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Hadrian.

OA at Hadrian?
Invisible during screen share
Get it