← Google Interview Insights

Google·Software Engineer·Online Assessment (OA)·Intermediate

IntermediatePrefer not to say
Jun 2026Remote

Summary

Google SWE online assessment, two problems in 90 minutes on HackerRank with AI assist enabled. The second problem was a feature rollout system with country/OS gating and dependency cycle detection, and it was a lot more involved than it sounds.

Questions Asked (4)

Q1

Implement a feature rollout evaluation system that gates users by country and OS version, then resolves per-feature dependencies while detecting and fully enumerating every member of any dependency cycle.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

This one wrecked my time budget.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a modular system with separate components for gating and dependency resolution. For dependency resolution, use a graph-based approach with DFS to detect cycles and enumerate all nodes in each cycle, ensuring the solution is efficient and scalable.

Pro tip: When detecting cycles, use Tarjan's strongly connected components algorithm to efficiently find all cycles, including nested ones, and enumerate every member. Also, discuss trade-offs between precomputing gates and evaluating on-the-fly for performance.

1. Clarify Requirements and Constraints

Ask questions to understand the scale, expected number of features, frequency of updates, and whether gating rules are static or dynamic. Clarify what constitutes a cycle and whether all cycles or just the first encountered need to be reported.

2. Design the Gating Mechanism

Propose a data structure to represent country and OS version rules, such as a decision tree or a set of predicates. Discuss how to efficiently evaluate a user against these rules, considering indexing or caching for performance.

3. Model Dependencies as a Graph

Represent features as nodes and dependencies as directed edges. Explain that a cycle exists if there is a path from a node back to itself, and that all nodes in a cycle must be identified.

4. Detect and Enumerate Cycles

Use DFS with recursion stack to detect cycles, but for full enumeration of all members in any cycle, use Tarjan's SCC algorithm. Explain how to extract all nodes in each SCC of size >1 or with self-loops.

5. Integrate and Optimize

Combine gating and dependency resolution: first filter features by gating, then resolve dependencies among enabled features. Discuss trade-offs like precomputing dependency graphs vs. on-demand resolution, and handling dynamic updates.

Key Points to Mention

  • Graph representation: adjacency list for dependencies, with nodes as features.
  • Cycle detection algorithms: DFS with recursion stack for detection, Tarjan's SCC for full enumeration.
  • Gating logic: use of predicates or rule engines, and efficient evaluation (e.g., indexing by country/OS).
  • Trade-offs: precomputation vs. lazy evaluation, memory vs. speed, and handling of dynamic rule changes.
  • Scalability: distributed processing or caching for large-scale feature sets.
  • Error handling: how to report cycles (e.g., list all features in each cycle) and fallback behavior.

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

Q2

Given a buggy dependency manifest parser that incorrectly merges multiple dependencies into a single string entry, identify and fix the bug with a minimal code change rather than rewriting from scratch.

Algorithms & Data StructuresRoot Cause Analysis
Author's notes

The bug was intentional and honestly pretty subtle under time pressure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, reproduce the bug with a minimal test case to understand how dependencies are being merged incorrectly. Then, trace the parsing logic to identify the exact line where merging occurs, and apply a minimal fix such as changing a string concatenation to a list append or adjusting a delimiter. Verify the fix with the test case and ensure no regressions.

Pro tip: Demonstrate a systematic debugging process: start by writing a failing test, then use print statements or a debugger to isolate the faulty line, and finally make the smallest possible change. This shows you can efficiently diagnose and fix issues without unnecessary rewrites.

1. Reproduce the Bug

Create a minimal input that triggers the incorrect merging, such as a manifest with two dependencies, and observe the output to confirm the issue.

2. Locate the Faulty Code

Trace through the parser code, focusing on where dependencies are collected and combined, to find the exact line causing the merge.

3. Identify the Root Cause

Determine why the code merges entries, e.g., using string concatenation instead of appending to a list, or missing a delimiter.

4. Apply Minimal Fix

Change the faulty line to correctly separate dependencies, such as replacing '+' with a list append or adding a delimiter, ensuring the change is as small as possible.

5. Verify and Test

Run the minimal test case to confirm the fix, then run the full test suite to ensure no regressions.

Key Points to Mention

  • Reproducing the bug with a minimal test case to understand the expected vs actual behavior.
  • Using debugging techniques like print statements or a debugger to trace the parsing logic.
  • Identifying the specific line where dependencies are incorrectly merged (e.g., string concatenation).
  • Applying a minimal fix, such as changing to list append or adding a delimiter, rather than rewriting.
  • Verifying the fix with the test case and running regression tests.
  • Communicating the root cause clearly and explaining why the fix is minimal and correct.

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

Q3

Extend an evaluate() function to handle dependency cycles of arbitrary length, ensuring the cycle report includes every node in the cycle including the entry node, not just the point where the cycle was rediscovered.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I lost the most time.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a depth-first search with a recursion stack to detect cycles, and when a back edge is found, extract the cycle by tracing back through the stack from the current node to the target node, ensuring the entry node is included. Then, report the cycle in the correct order, including all nodes from the entry point back to itself.

Pro tip: Emphasize that the cycle report should be a closed loop starting and ending at the entry node, and discuss how to handle multiple cycles or nested cycles if they exist.

1. Detect cycle using DFS

Perform a depth-first search while maintaining a recursion stack to track the current path. When a node is revisited and is already in the stack, a cycle is detected.

2. Extract cycle nodes

Once a back edge is found, trace back through the recursion stack from the current node to the node that was revisited (the entry node of the cycle), collecting all nodes along the way.

3. Construct cycle report

Arrange the collected nodes in the order they appear in the cycle, starting from the entry node and ending with the entry node again to show the full cycle.

4. Handle arbitrary length and multiple cycles

Ensure the algorithm works for cycles of any length and can detect and report multiple independent cycles if present, possibly by continuing the DFS after reporting a cycle.

Key Points to Mention

  • Use of recursion stack or color-coding (white, gray, black) for cycle detection
  • Tracing back through the stack to collect all nodes in the cycle
  • Including the entry node in the cycle report by starting and ending with it
  • Time complexity O(V+E) and space complexity O(V) for the DFS
  • Handling of self-loops and two-node cycles as special cases
  • Potential need to avoid infinite loops when reporting cycles in a graph with multiple cycles

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

Q4

When a feature's dependency is itself part of the current rollout batch (not yet resolved), how should the evaluation handle it rather than auto-rejecting?

Algorithms & Data StructuresAdaptability & Ambiguity
Author's notes

I got this wrong on my first pass and just returned a rejection.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame the problem as a dependency graph within a rollout batch and propose a deferred evaluation strategy: mark the feature as pending until its dependencies resolve, then re-evaluate. Emphasize that auto-rejecting is incorrect because it breaks atomic rollouts and ignores intra-batch dependencies.

Pro tip: Mention that this is essentially a topological sort problem and that you'd use cycle detection to avoid infinite loops; also note that the same pattern applies to build systems and package managers, showing you recognize the general principle.

1. Clarify the scenario

Restate the problem: a feature depends on another feature in the same rollout batch that hasn't been resolved yet. Confirm that auto-rejecting would be premature and could cause valid features to fail.

2. Model dependencies as a graph

Represent features as nodes and dependencies as directed edges. Within a batch, this forms a directed graph that may contain cycles.

3. Defer evaluation, don't reject

Instead of rejecting, mark the feature as 'pending' or 'blocked' and defer its evaluation until its dependencies are resolved. This allows the batch to be processed in dependency order.

4. Resolve dependencies via topological order

Process features in topological order so that dependencies are resolved before dependents. If a cycle exists, detect it and handle appropriately (e.g., report an error or break the cycle).

5. Re-evaluate and finalize

Once dependencies are resolved, re-evaluate the feature. If dependencies succeed, proceed; if they fail, then reject or handle accordingly. This ensures correctness and avoids false negatives.

Key Points to Mention

  • Dependency graph representation and topological sorting
  • Cycle detection to prevent infinite loops
  • Deferred evaluation vs. immediate rejection
  • Batch processing and atomic rollouts
  • Error handling for unresolvable dependencies
  • Analogies to build systems (e.g., Bazel) and package managers

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