Code Room
CodingMediumcod-g1148
Subject Networking protocolsLevel Mid–Senior~22 minCommon in Networking & APIs · Algorithms & data structures interviewsIndustries Telecom, Software development

Question

Given a list of inclusive IPv4 address ranges as [start_ip, end_ip] pairs (each start <= end), merge all overlapping AND adjacent ranges (two ranges touch if one's start is exactly one greater than the other's end). Return the merged ranges sorted ascending as [start_ip, end_ip] string pairs. This is a different problem from generic interval merging because adjacency on the integer address space must coalesce. All IPs are valid IPv4.

Implement
merge_ip_ranges(ranges: list[list[str]]) → list[list[str]]
Examples
in[[["10.0.0.0","10.0.0.5"],["10.0.0.3","10.0.0.9"]]]out[["10.0.0.0","10.0.0.9"]]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.