← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an undirected network (graph) with n nodes labeled 0 … n-1 and a list of edges. Some nodes are initially infected by a virus. Every minute, each newly infected node passes the virus to every neighbor that is not yet infected. The process continues until no new nodes can be infected.
Write a function that receives:
Your function must return the list of all nodes that are ever infected, sorted in ascending order.