Merge IPv4 address ranges
Your task
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.
Examples
merge_ip_ranges(ranges: list[list[str]]) -> list[list[str]]Example 1
Input
merge_ip_ranges([["10.0.0.0", "10.0.0.5"], ["10.0.0.3", "10.0.0.9"]])Output
[["10.0.0.0", "10.0.0.9"]]