This questions has 2 parts course schedule 1 (question num 207) and course schedule 2 ( question num 210). I initially wrote a inefficient code for the second part, question 210 and was accepted.