Configuration word bit changes
A rollout service ships device settings as one 32 bit configuration word. Bit i of that word, counting the least significant bit as bit 0, holds the flag named at position i of flag_names. Positions at or beyond the length of flag_names are reserved for other subsystems and must be ignored, even when their bits are set. Given the word a device carried before a rollout and the word it carries after, return one entry for every named flag whose bit changed, ordered by ascending bit position. Write an entry as the flag name, then a colon, then on when that bit is set in after, or off when the bit was set in before and is clear in after. Flags left alone contribute nothing, so an unchanged word returns an empty list.
flag_rollout_changes(flag_names: list[str], before: int, after: int) → list[str][["dark_mode","beta_search","new_editor"],1,6]out["dark_mode:off","beta_search:on","new_editor:on"][["autosave","telemetry"],3,3]out[][["autosave"],0,9]out["autosave:on"]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.
[["dark_mode","beta_search","new_editor"],1,6]["dark_mode:off","beta_search:on","new_editor:on"]not run yetsample[["autosave","telemetry"],3,3][]not run yetsample[["autosave"],0,9]["autosave:on"]not run yetsample