Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
bytes solution in Clear category for IP Network: Route Summarization by gyahun_dash
def checkio(adds):
version, length = [b * len(adds[0].split('.')) for b in (1, 8)]
ints = [int.from_bytes(bytes(map(int, a.split('.'))), 'big') for a in adds]
rembit = (max(ints) ^ min(ints)).bit_length()
subnet = length - rembit
prefix = ints[0] >> rembit << rembit
address = '.'.join(map(str, map(int, prefix.to_bytes(version, 'big'))))
return '{}/{}'.format(address, subnet)
March 11, 2016
Comments: