Sponsored
Use these hints if you're stuck. Try solving on your own first.
For each request, we could loop through all restrictions. Can you think of doing a check-in close to O(1)?
Could you use Union Find?
Solve with full IDE support and test cases