Detect Cycle in Directed Graph DFS

Given a directed graph with n vertices and edges, detect if the graph contains a cycle. Return true if cycle exists, false otherwise.

Examples
Input: [4,[[0,1],[1,2],[2,3]]]
Output: false
Hints

Detect Cycle in Directed Graph DFS

Given a directed graph with n vertices and edges, detect if the graph contains a cycle. Return true if cycle exists, false otherwise.