Skip to main content
medium

IPv4 Iterators and CIDR

Also known as: IP to CIDR

Part 1: IPv4 Forward Iterator - IPv4Iterator(start_ip) starts at start_ip (inclusive) - next() returns the next IP as dotted string - When exhausted, next() returns "null"

Build practical IPv4 primitives: forward/reverse iterators, CIDR range expansion, and (finally) covering N sequential IPs with minimum CIDR blocks. This tests bitwise thinking, boundary discipline, and writing clear stateful code.

Bit ManipulationMath & Geometry

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1IPv4 Forward Iteratoreasy
2Part 2
3Part 3
4Part 4

Each locked part opens in the editor once the part before it passes.

Based onLeetCode