OpenAI·Software Engineer·Technical Phone Screen
Jun 2026
OpenAI interview focused entirely on designing a family of IPv4 iterators in Python. The technical depth surprised me, it went way beyond just 'implement a range' and kept pushing on memory, complexity, and edge cases I hadn't thought through.
- Design a family of IPv4 iterators: a forward iterator starting from a given IP up to 255.255.255.255, a reverse iterator going down from a given IP to 0.0.0.0, and a CIDR-block iterator that yields every IP in a block like '192.168.1.0/24'. Walk through your implementation and discuss the time and space complexity of each.
- How would you optimize these iterators to avoid repeated string parsing and formatting on every step?
- What are the trade-offs between lazy generation and materializing the full IP range up front, especially when the consumer might only page through part of the iterator versus consuming it fully?
- Should the iterator's __next__ support skipping ahead by an arbitrary delta in O(1) time? How would you implement that and what does it change about the design?
“My first instinct was to store IPs as strings throughout and I started going down that path before the interviewer raised an eyebrow.” The rest of the author's notes on Software Engineer interview at OpenAI, Technical Phone Screen round, covers how they worked through the question, what the panel pushed back on, and what they would do differently.
View Post