Reported February 2024
IBMdepth first search

Total Execution Time

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

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

IBM's "Total Execution Time" question shows up in their OAs and it's a simulation problem dressed up as a scheduling puzzle. You're given tasks with durations and dependencies, and you need to calculate how long the whole thing takes. It's not about optimization. It's about walking through the timeline correctly and tracking state. Most candidates overthink the dependency resolution. StealthCoder reads the exact problem statement on screen and hands you the pattern before you blank on how to order the traversal.

Pattern and pitfall

The core pattern is a directed acyclic graph (DAG) traversal. Each task is a node. Dependencies are edges. Total execution time is the longest path from start to finish, which means you're doing topological sort plus longest-path calculation. The trick: don't greedily schedule. Compute the earliest finish time for each task by working backwards from dependencies. Many candidates confuse this with job scheduling or greedy packing. It's neither. You need either depth-first search with memoization or breadth-first search with in-degree tracking. StealthCoder will surface the exact graph structure and the recurrence relation you need. That's the safety net if you panic on the live OA.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Total Execution Time 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

IBM reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Total Execution Time FAQ

Is this a greedy problem or DP?+

Neither directly. It's graph traversal with longest-path calculation. You compute the earliest finish time for each task using memoization or topological order. Greedy doesn't work because a shorter task might block a longer critical path.

What if there are cycles in the dependencies?+

The problem assumes a valid DAG. If you see a cycle during traversal, that's invalid input. Most OAs won't include that edge case, but code defensively with cycle detection if you have time.

How do I handle tasks with no dependencies?+

They start at time 0 and finish at their duration. When you traverse, they become base cases in your recursion or your queue's initial layer in BFS.

Is the answer always the finish time of one specific task?+

Yes. The answer is the maximum finish time across all tasks. Once you compute finish times for every task, take the max. That's your total execution time.

How do I prepare for this in 48 hours?+

Practice topological sort and longest path on a DAG. Code both DFS with memoization and BFS with in-degrees. Draw out a small dependency graph by hand first. The pattern clicks fast once you see it.

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

OA at IBM?
Invisible during screen share
Get it