Your question is Directed Graph Cycle Detection. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a directed graph with n nodes labeled 0 to n - 1, determine whether the graph contains at least one cycle.
Implement a function that returns True if the graph has a cycle, otherwise return False.
n, an integer representing the number of nodes.edges, a list of directed edges, where each edge is a pair [u, v] meaning there is an edge from u to v.def has_cycle(n, edges):