Code Room
CodingMediumcod-g1118
Subject AuthLevel Mid–Senior~20 minCommon in Security interviewsIndustries Software development

Question

Check whether a granted OAuth scope set satisfies a required scope set with hierarchical wildcards. Scopes are colon-delimited (e.g. 'repo:read', 'admin:*'). A granted scope satisfies a required scope if they are equal, OR the granted scope ends in a '*' segment and its prefix segments are a prefix of the required scope's segments (e.g. 'admin:*' satisfies 'admin:read' and 'admin:billing:write'; '*' satisfies everything). Return True only if every required scope is satisfied by at least one granted scope.

Implement
scopes_satisfied(granted: list[str], required: list[str]) → bool
Examples
in[["repo:read","repo:write"],["repo:read"]]outtrue
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.