Question
The same access-control service must display a user's permissions as human-readable names. Given a non-negative bitmask and the ordered list of permission names (the name at index i corresponds to bit i), return the list of names whose bits are set in the mask, in flag-list order. The mask may have set bits beyond the last known name — perhaps written by a newer service version — and those must be ignored. For example, mask 5 with ["read", "write", "delete"] returns ["read", "delete"].
decode_permissions(mask: int, flags: list[str]) → list[str][5,["read","write","delete"]]out["read","delete"][10,["r","w","x","admin"]]out["w","admin"]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.