Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for IP Network: Route Summarization by Moff
def checkio(addrs):
addrs = [sum(x << d for x, d in zip(map(int, addr.split('.')), (24, 16, 8, 0))) for addr in addrs]
i = 0
while any(a != addrs[0] for a in addrs):
addrs = [a >> 1 for a in addrs]
i += 1
addr = addrs[0] << i
return '{}/{}'.format('.'.join(str((addr >> b) & 0xFF) for b in (24, 16, 8, 0)), 32 - i)
March 12, 2016