Folks making incorrect prereq lists?


  • 1
    G

    The problem says :
    [[1,0]]
    There are a total of 2 courses to take. To take course 1 you should have finished course 0.

    With that Course 0 (prerequisites[i][1]) is a prereq for course 1 (prerequisites[i][0]]). But I noticed many folks coding it this way :

    graph[prerequisites[i][1]].add(prerequisites[i][0]);
    

    I believe its incorrect and it should be opposite. But solution still works fine because cycle is detected in both the cases.

    Am I getting it right here?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.