Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

In an access‑control system, each role may have privileges explicitly allowed or disallowed, and can inherit privileges from other roles. Given a hierarchy of roles (a Directed Acyclic Graph) and per‑role allowed/disallowed privilege lists, determine the final set of privileges each role is permitted.

Test Cases
Input
Output
Expected