← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Google SWE coding round, one algorithm question that started familiar and then got weird. The base problem was course scheduling but they threw in some extra condition mid-interview that wasn't in any prep material I'd seen.

Questions Asked (1)

Q1

Given a number of courses and a list of prerequisite pairs, determine whether it's possible to complete all courses. The interviewer also introduced an additional variant condition on top of the standard problem.

Algorithms & Data StructuresAdaptability & Ambiguity
Author's notes

I knew the base version cold, cycle detection in a directed graph, topological sort, done it a hundred times.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the courses and prerequisites as a directed graph and check for cycles using topological sorting (Kahn's algorithm) or DFS. For the additional variant, clarify the condition, then adapt the algorithm accordingly, explaining your reasoning and trade-offs.

Pro tip: After solving the standard problem, proactively discuss how you would handle the variant by identifying what changes in the graph model or algorithm, showing adaptability and deep understanding.

1. Clarify the problem and variant

Ask questions to understand the exact requirements, especially the additional variant condition, and confirm input/output formats and edge cases.

2. Model as a graph

Represent courses as nodes and prerequisites as directed edges. Explain that a cycle indicates impossibility.

3. Choose an algorithm

Select topological sort (Kahn's or DFS) to detect cycles. Discuss time and space complexity.

4. Adapt to the variant

Modify the approach based on the variant condition, such as adding constraints or changing the graph structure, and explain the adjustments.

5. Test and validate

Walk through examples, including edge cases like no prerequisites or disconnected components, to verify correctness.

Key Points to Mention

  • Directed graph representation and cycle detection
  • Topological sorting algorithms: Kahn's (BFS) and DFS
  • Time and space complexity analysis (O(V+E))
  • Handling disconnected graphs and multiple components
  • Adaptability to variant conditions (e.g., limited course load per semester, parallel courses)
  • Edge cases: empty input, self-loops, duplicate edges

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