← Google Interview Insights

Google·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Google ML engineer interview with a graph algorithms problem. Nothing too wild but it required you to actually think through the dependency structure carefully rather than just pattern-match to a known algorithm.

Questions Asked (1)

Q1

Given a directed acyclic graph where each node has a duration, find the minimum total time needed to complete all tasks, where a task can only begin once all its dependencies finish.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The key realization is that this reduces to finding the longest path through the DAG, which took me a minute to see.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as a longest path in a DAG where each node's weight is its duration. Compute the earliest start time for each task using topological order, then the minimum total time is the maximum earliest finish time.

Pro tip: Mention that this is equivalent to finding the critical path, and discuss how the approach scales to large graphs with parallel execution.

1. Clarify the problem

Confirm that tasks can run in parallel if dependencies allow, and that the goal is to minimize the makespan (total completion time).

2. Model as a DAG

Represent tasks as nodes with weights (durations) and dependencies as directed edges. The problem reduces to finding the longest path in this DAG.

3. Topological sort

Perform a topological sort to order tasks such that each task appears after its dependencies. This ensures we process tasks in a valid order.

4. Dynamic programming

For each task in topological order, compute its earliest start time as the maximum earliest finish time of its dependencies. Its earliest finish time is start time plus duration.

5. Compute makespan

The minimum total time is the maximum earliest finish time among all tasks. Return this value.

Key Points to Mention

  • Topological sorting to handle dependencies
  • Dynamic programming to compute earliest start/finish times
  • Longest path in a DAG and its relation to the critical path
  • Time complexity: O(V+E) with topological sort and DP
  • Space complexity: O(V+E) for graph storage and O(V) for DP arrays
  • Handling of disconnected components and multiple start nodes

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.