← 返回 uber 的题目列表Detect Cycle in Directed Graph
类型:online_judge
Given a directed graph with many services, each having dependencies on others, determine if there is a cycle in the graph. If there are multiple dependency arrays, how can you determine if there is a cycle?
Example
Input
4
[[0, 1], [1, 2], [2, 3], [3, 0]]