Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in 3rd party category for Network Attack by _Chico_
import numpy as np
import copy
def capture(matrix):
matrix = np.array(matrix)
state = copy.deepcopy(np.diag(matrix))
np.fill_diagonal(matrix,0)
t=0
while(np.sum(state) != 0):
state -= ((np.sum(matrix[state == 0],axis=0) > 0) & (state != 0)).astype(int)
t+=1
return t
May 14, 2021