← Questions
Feature flags across channels with inheritance
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A coding interview question asked in CoreWeave's coding round, last asked Jan 2026. It tests hash maps, graphs and inheritance.
Build a feature flag store organized by channels. Each channel has an id, its own map of flag names to true or false, and zero or more parent channels. Looking up a flag on a channel returns the channel's own value if it sets one, otherwise the value from the nearest parent that sets it, and false when no ancestor does.
- Implement creating a channel (with its flags and parents), reading a flag, setting a flag on a channel, and deleting a channel.
- In production, lookups far outnumber changes. How would you make reads fast?
- When a flag changes on one channel, how do you keep lookups correct and fast for every channel that inherits from it, at scale?
Clarifying questions
- With several parents, which is "nearest": the fewest steps up, with ties broken by parent order?
- Can parents form a cycle, and must creating a channel reject one?
- When a channel is deleted, what happens to its children: lose that parent, or inherit its parents?
- Can a channel clear its own value to go back to inheriting?
- How many channels and flags are there, and how many reads a second?
What a strong answer covers
- Part 1: a map from channel to its flags and parents; a lookup is a breadth-first walk up from the channel that returns the first value found, in a fixed tie order; creation rejects unknown parents and cycles.
- Part 2: cache resolved values per channel and flag, or keep each channel's fully resolved flag map, so a read is O(1).
- Part 3: reverse edges to children, so a change only touches descendants that do not set the flag themselves; either recompute them eagerly or invalidate them lazily, with a version so readers never mix old and new values; the trade-off between the two at scale.
- Deletion that updates the children's parents and their cached values.
- Tests: diamond inheritance, an override in the middle of a chain, deleting a channel in the middle.
Follow-ups
- Percentage rollouts and targeting by user attributes.
- Send flags to many servers: push with versions and local caches.
- Audit and roll back flag changes.
Where it's asked
What it tests
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
