Code Room
CodingHardcod-g845
Subject IntervalsLevel Senior–Staff~40 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Implement a feature-flag rollout tracker that maintains a set of half-open integer ranges [left, right). You are given a list of operations, each one of: ["add", left, right] activates the rollout over that range; ["remove", left, right] deactivates it; ["query", left, right] reports whether the ENTIRE half-open range [left, right) is currently fully active. Process the operations in order and return a list of booleans, one per query operation. Ranges can be added, partially removed, and re-added many times.

Implement
range_module(ops: list[list]) → list[bool]
Examples
in[[["add",10,20],["remove",14,16],["query",10,14],["query",13,15],["query",16,17]]]out[true,false,true]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.