Domanda di colloquio di Samsung Electronics

Print the loop nodes in a directed cyclic graph?