Error with the test case?


#1

This is the test case:
A : 18
B : [ 11, 5, 13, 12, 5, 11, 4, 16, 7, 18, 12, 6, 6, 9, 10, 15, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 2, 4, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 1 ]
C : [ 17, 18, 14, 9, 3, 8, 10, 14, 15, 1, 3, 17, 4, 8, 7, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 ]

To take course 18, we only need to be able to take course 5, and since 5 does not appear in C; there is no cycle. The result should be 1, but the expected output is 0. Solved using Python 3. Hope I’m not missing anything.