PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Google

Find Feature Activation Order

Last updated: Apr 22, 2026

Quick Overview

This question evaluates graph-algorithms and dependency-resolution skills, including reasoning about prerequisite relationships, ordering constraints, and cycle detection.

  • easy
  • Google
  • Coding & Algorithms
  • Software Engineer

Find Feature Activation Order

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Take-home Project

You are building a feature-flag system for a product. There are `n` features labeled `0` to `n - 1`. Each dependency pair `[a, b]` means feature `a` depends on feature `b`, so `b` must be active before `a` can be activated. You are also given: - a set `active` of features that are already enabled, and - a target feature `t` that a user wants to activate. A feature can be activated only after **all** of its direct and indirect prerequisites are active. If a prerequisite is not active yet, it must be activated first. Write a function that returns **one valid order** of newly activated features needed to enable `t`. Rules: 1. Only include features that are not already active. 2. The returned order must activate prerequisites before any dependent feature. 3. If `t` is already active, return an empty list. 4. If `t` cannot be activated because its dependency chain contains a cycle, return `null`. Example: - `dependencies = [[3,1],[3,2],[2,0]]` - `active = {1}` - `t = 3` A valid answer is `[0,2,3]`. Implement this efficiently.

Quick Answer: This question evaluates graph-algorithms and dependency-resolution skills, including reasoning about prerequisite relationships, ordering constraints, and cycle detection.

Related Interview Questions

  • Solve Rooms and Top-K Streams - Google (medium)
  • Find Containing Range - Google (medium)
  • Rearrange Tasks With Cooldown - Google (medium)
  • Implement Employee Management and Expression Evaluation - Google (medium)
  • Solve Three Array and Matrix Path Problems - Google (medium)
Google logo
Google
Jan 26, 2026, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
6
0
Loading...

You are building a feature-flag system for a product.

There are n features labeled 0 to n - 1. Each dependency pair [a, b] means feature a depends on feature b, so b must be active before a can be activated.

You are also given:

  • a set active of features that are already enabled, and
  • a target feature t that a user wants to activate.

A feature can be activated only after all of its direct and indirect prerequisites are active. If a prerequisite is not active yet, it must be activated first.

Write a function that returns one valid order of newly activated features needed to enable t.

Rules:

  1. Only include features that are not already active.
  2. The returned order must activate prerequisites before any dependent feature.
  3. If t is already active, return an empty list.
  4. If t cannot be activated because its dependency chain contains a cycle, return null .

Example:

  • dependencies = [[3,1],[3,2],[2,0]]
  • active = {1}
  • t = 3

A valid answer is [0,2,3].

Implement this efficiently.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.