Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
7-liner: recursive solution in Creative category for Network Attack by przemyslaw.daniel
def capture(data, node=0, last=0, visited=set(), result=dict()):
if not node: result = dict()
result[node] = min(result.get(node, 99), last)
for i in range(len(data)):
if i not in visited | {node} and data[node][i] > 0:
capture(data, i, last+data[node][node], visited | {node}, result)
return max([result[x]+data[x][x] for x in result])
April 26, 2017
Comments: