Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Third solution in Clear category for Network Attack by gyahun_dash
def capture(matrix):
timeline = {0: 0} # id: time
rest = set(range(1, len(matrix)))
while rest:
infected = min(timeline, key = timeline.get)
time = timeline.pop(infected)
targets = rest & {i for i, link in enumerate(matrix[infected]) if link}
timeline.update((i, time + matrix[i][i]) for i in targets)
rest -= targets
return max(timeline.values())
Oct. 19, 2014