Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Network Attack by capback250
"use strict";
function capture(data) {
let timer = 0, hacked = new Set();
let queue = data[0].map((el, i) => {
if (el === 1) return [data[i][i], i]
})
.filter(el => el !== undefined);
while (hacked.size < data.length) {
timer += 1;
for (let node of queue) {
if (node[0] === timer) {
hacked.add(node[1]);
data[node[1]].map((el, i) => {
if (el === 1 && !hacked.has(i)) {
queue.push([data[i][i] + timer, i])
}
})
}
}
}
return timer
}
April 19, 2017