Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Network Attack by Beo
def capture(matrix):
time={x:0 for x in range(len(matrix))}
infected=[0]
for i in infected:
for j in range(len(matrix[i])):
if i!=j and matrix[i][j]==1:
if j not in infected:
infected+=[j]
time[j]=time[i]+matrix[j][j]
else:
time[j]=min(time[j],time[i]+matrix[j][j])
return max(time.values())
Oct. 15, 2018