OpenAI

Verified interview challenge

Build an IPv4 address iterator

Extend an address iterator through forward traversal, reverse traversal and subnet boundaries.

Unlock with Full Access

The challenge

Build one iterator across successive parts rather than starting again for each requirement. Later parts add reverse movement and CIDR limits, followed by a written optimisation discussion. The exercise tests address representation and boundary behaviour as well as your ability to explain the implementation.

What you'll practise

  • Address boundaries

    Keep traversal correct across octets and the permitted address range.

  • Implementation reasoning

    Explain the efficiency of the iterator after the coding parts.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.