✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
You are given a weakly connected directed weighted graph — connected when the edge directions are ignored — and asked whether it contains a negative cycle anywhere— not just one reachable from some particular vertex.
Which approach settles it in O(|V| · |E|) time?