Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Implement a firewall class that evaluates IPv4 addresses against an ordered list of ALLOW/DENY rules.
Rules can specify single hosts or CIDR blocks, with decision priority determined strictly by insertion order.
Return true or false based on the action of the first rule that matches the queried IP.
What This Tests
Bitwise manipulation and 32-bit integer arithmetic
Network addressing fundamentals and CIDR prefix matching
Ordered data structure traversal and priority-based filtering
String parsing and data normalization
Common Patterns
Bit Manipulation
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Report
Report seen similar question in interview
Accepted
3.2k
/7.8k
Acceptance Rate
40.4%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Python3
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected