Question
A rollout tool stores n feature flags as a row of bits, one per flag, each on (1) or off (0). To limit blast radius, policy forbids enabling two adjacent flags at the same time. Return how many distinct flag configurations of length n satisfy the policy. For n = 0 return 1 (the empty configuration). For example, n = 2 allows 00, 01, and 10 — but not 11 — so the answer is 3.
count_valid_flag_masks(n: int) → int[2]out3[3]out5State 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.