There are n courses labeled 0..n-1. Each directed edge [a, b] means course b must be taken before course a. Determine whether it is possible to finish all courses (i.e. the prerequisite graph has no cycle). Return true or false. The input is JSON {n, edges}.
Input: JSON {n, edges}.
Output: Boolean — true or false.
Input: {"n":2,"edges":[[1,0]]}
Output: true
Explanation: Take 0 then 1.Input: {"n":2,"edges":[[1,0],[0,1]]}
Output: false
Explanation: Circular prerequisites.Input: {"n":1,"edges":[]}
Output: true
Explanation: No prerequisites.1<=n<=10^5directed prerequisites