ACL rule access decision
Resolve an access decision from a list of ACL rules. Each rule is [effect, principal, action] where effect is 'allow' or 'deny'. A rule matches the request (user, action) if its principal equals the user or '*', and its action equals the action or '*'. Deny takes precedence over allow: if any matching rule denies, the result is 'deny'. Otherwise if any matching rule allows, the result is 'allow'. If no rule matches, the result is 'deny' (default-deny). Return the decision string.
Implement
resolve_acl(rules: list[list[str]], user: str, action: str) → strExamples
in
[[["allow","alice","read"],["deny","*","read"]],"alice","read"]out"deny"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.
0:00 of about 20 min
solution.py
InputExpectedGot
[[["allow","alice","read"],["deny","*","read"]],"alice","read"]"deny"not run yetsample