As reported: CoreWeave technical coding onsite for a Weights & Biases role (USA, early 2026): design a feature flagging system made of channels, implement four operations, then two follow-ups — in production there are far more reads than writes, so how do you optimize reads; and when a flag value changes on a channel, how do you keep lookups correct at scale.
A feature flagging system is made of channels. Each channel has a unique id, a mapping of feature flags to booleans, and zero or more parent channels. A channel inherits features from its parents:
- if the feature is defined on the channel itself, return that value;
- otherwise inherit it from the closest parent channel that defines it;
- if no ancestor defines it, the feature is
false.
Implement a FeatureFlags class:
create_channel(channel_id, features, parents) -> bool— create a channel with its own flags and its parents (in priority order). Returnsfalseand creates nothing if the id already exists or a parent does not exist.get_feature(channel_id, feature_name) -> bool— the resolved value;falsefor an unknown channel.set_feature(channel_id, feature_name, value) -> bool— define or overwrite the flag on that channel;falseif the channel does not exist.delete_channel(channel_id) -> bool— remove the channel;falseif it does not exist.
Example
create_channel("base", {dark_mode: false, search_v2: true}, []) -> true
create_channel("beta", {dark_mode: true}, ["base"]) -> true
create_channel("team", {}, ["beta"]) -> true
get_feature("team", "dark_mode") -> true from beta
get_feature("team", "search_v2") -> true from base, two levels up
get_feature("team", "new_ui") -> false nobody defines it
set_feature("beta", "dark_mode", false) -> true
get_feature("team", "dark_mode") -> false
delete_channel("beta") -> true
get_feature("team", "search_v2") -> false team no longer has a parent
Clarifications
- "Closest" means the fewest parent hops. When several ancestors at the same distance define the flag, the one reached first through the parent lists in order wins (search parents breadth-first, each list in its given order).
- A channel's own value always wins, even
falseover an inheritedtrue. - Deleting a channel removes it from its children's parent lists; the children keep their other parents and their own flags.
- Channel ids and feature names are non-empty strings.
Constraints: up to 5000 operations; up to 2000 channels; a channel has at most 4 parents.
Code runner format: two lines, LeetCode's design format: the operation names ("FeatureFlags", "create_channel", "get_feature", "set_feature", "delete_channel") and their argument lists. features is given as a list of [name, value] pairs, which the harness turns into a dictionary / map before calling you. Method names are snake_case in Python, camelCase in Java, C++ and JavaScript (createChannel, …), and capitalized in Go (CreateChannel, with Constructor()). The harness prints the list of results (null for the constructor).