Dsa
Trie
Easy
Subdomain Firewall
A firewall blocks traffic to specific domains. If 'badsite.com' is blocked, then 'mail.badsite.com' and 'api.v1.badsite.com' are also blocked. However, 'goodsite.com' or 'badsite.net' are not blocked. Given a list of blocked domains and a list of queries, determine if each query is 'BLOCKED' or 'ALLOWED'.
Example:
Input:
1
badsite.com
2
api.badsite.com
google.com
Output:
BLOCKED
ALLOWED
Key concepts
triesuffix-matchingreverse-strings
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now