Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Network Attack by akaka
def capture(m):
time = 0
connected = []
while(any(v > 0 for v in [m[w][w] for w in range(0, len(m))])):
time += 1
for g in [x for x in range(0, len(m)) if m[x][x] <= 0]:
connected.extend([y for y in range(0, len(m)) if g != y and m[g][y] > 0])
for z in set(connected):
m[z][z] -= 1
return time
Sept. 20, 2018