← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Google SWE interview with a meaty design question about a feature activation engine. The problem had enough moving parts that I kept second-guessing myself on the deactivation cascade logic, but the graph fundamentals were solid ground to stand on.

Questions Asked (1)

Q1

Design a feature flag activation engine where each feature has prerequisite features that must be active before it can be enabled. Support activate, deactivate (with transitive cascade), and cycle detection operations.

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

The activate part was fine, just check all prereqs in the active set.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the feature dependencies as a directed graph and use topological ordering or DFS to manage activation and deactivation. For activation, ensure all prerequisites are active; for deactivation, perform a transitive cascade to deactivate dependents. Detect cycles during graph construction or before activation to prevent invalid states.

Pro tip: Discuss the trade-offs between eager and lazy cycle detection, and how you would handle concurrent operations to ensure thread safety in a distributed environment.

1. Clarify Requirements and Assumptions

Ask clarifying questions about scale, concurrency, persistence, and whether features can have multiple prerequisites. Confirm that deactivation should cascade to all dependents transitively.

2. Design Data Structures

Represent features as nodes in a directed graph, with edges from prerequisite to dependent. Use adjacency lists for efficient traversal and maintain a set of active features.

3. Implement Core Operations

For activate, check all prerequisites are active and no cycles exist. For deactivate, perform a BFS/DFS to find all transitive dependents and deactivate them. For cycle detection, use DFS with recursion stack or topological sort.

4. Handle Edge Cases and Concurrency

Address scenarios like activating an already active feature, deactivating a feature with no dependents, and concurrent requests. Use locks or transactional semantics to maintain consistency.

5. Analyze Complexity and Trade-offs

Discuss time and space complexity of operations, and trade-offs between eager vs lazy cycle detection, and between in-memory vs persistent storage.

Key Points to Mention

  • Graph representation with adjacency lists for efficient traversal
  • Topological sorting or DFS for cycle detection
  • Transitive closure for cascade deactivation
  • Thread safety and concurrency control mechanisms
  • Time and space complexity analysis (e.g., O(V+E) for DFS)
  • Trade-offs between eager and lazy cycle detection, and scalability considerations

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