← Google Interview Insights

Google·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Google ML Engineer interview with a scheduling problem that sounds straightforward until you actually have to implement it. Classic graph problem dressed up with a real-world wrapper.

Questions Asked (1)

Q1

Given a directed acyclic graph of tasks where each task has a duration, and M workers running in parallel, find the minimum time needed to complete all tasks while respecting dependencies.

Algorithms & Data StructuresSystem Design
Author's notes

I knew this was a topological sort situation but the parallel workers part tripped me up for a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., preemption, worker assignment) and then present a solution using list scheduling with a priority queue based on critical path (longest path to sink). Simulate task execution by always assigning the next available task with the highest priority to a free worker, updating task start times based on dependencies and worker availability.

Pro tip: Mention that this problem is NP-hard in general (P|prec|Cmax) but for DAGs with unit or arbitrary durations, list scheduling based on critical path gives a 2-approximation; Google interviewers appreciate awareness of theoretical limits and practical heuristics.

1. Clarify constraints and assumptions

Ask whether tasks can be preempted, if workers are identical, and if tasks can start immediately when dependencies are met. Confirm that the goal is to minimize makespan (total completion time).

2. Model the problem

Represent the DAG with adjacency lists and compute for each task its earliest start time (EST) based on dependencies. Also compute the critical path length (longest path) to prioritize tasks.

3. Design scheduling algorithm

Use a priority queue (min-heap for EST, max-heap for critical path) to select the next task to assign to a free worker. Simulate time steps or use event-driven simulation to track worker availability and task completion.

4. Analyze complexity and optimality

Discuss time complexity (O(V log V + E) for priority queue operations) and note that the problem is NP-hard, so the algorithm is a heuristic. Mention that for unit durations and unlimited workers, it reduces to longest path.

5. Consider extensions and edge cases

Address scenarios like limited workers causing idle time, tasks with zero duration, and disconnected DAGs. Optionally, discuss how to adapt for real-time systems or ML pipelines.

Key Points to Mention

  • Critical path method (CPM) for determining task priorities
  • List scheduling algorithm with priority queue
  • NP-hardness of P|prec|Cmax and approximation guarantees
  • Event-driven simulation for efficient time tracking
  • Handling of worker availability and task dependencies
  • Potential for parallelization and load balancing

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