Membership Checks Against IP Lists With Exclusions

Last updated: November 29, 2026

Quick Overview

Build a structure from an IP list made of CIDR blocks, explicit ranges and exclusion entries prefixed with '!', then answer many queries of whether an IPv4 address belongs to the list. Exclusions always win over inclusions.

Illumio
Coding & Algorithms
Software Engineer
Illumio
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Build a structure from an IP list made of CIDR blocks, explicit ranges and exclusion entries prefixed with '!', then answer many queries of whether an IPv4 address belongs to the list. Exclusions always win over inclusions.

Illumio IP lists describe things like corporate ranges or third-party networks and support exclusions, and they are compiled into firewall sets on every enforced host. The interviewer checks interval normalization, correct subtraction, and a fast lookup rather than scanning every entry per query.

What the Interviewer Expects
  • Converts CIDRs and ranges to integer intervals
  • Merges overlapping and adjacent inclusions
  • Subtracts exclusions in a single merged pass
  • Uses binary search for O(log n) queries
  • Discusses IPv6 and the size of the resulting interval set
Key Topics to Cover
Interval merging
Interval subtraction
Binary search
CIDR math
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you produce the minimal list of CIDR blocks for the result, for an ipset of type hash:net?
  • How would you support IPv6 with the same code?
  • The list is edited often. How would you update incrementally?
  • How would you diff two IP lists to show a reviewer what changed?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Entries: a.b.c.d/n, a.b.c.d-e.f.g.h, or either form prefixed with ! for exclusion. Build once, query many times. Result semantics: an address is in the list if it is in some inclusion and in no ...

High-Level Design

Map each address to a 32-bit integer. Convert every entry to a closed interval, merge inclusions and exclusions separately (treating adjacency as overlap), then subtract the merged exclusions from the...


Submit Your Answer
Markdown supported

Related Questions