leetle

Daily challenge for 2025-05-30

150. Course Schedule

Write a function solve that takes the number of courses num_courses and an array of prerequisites prerequisites where prerequisites[i] = [a, b] indicates that you must take course b before taking course a. Return true if you can finish all courses, otherwise return false.

Example:
Input: num_courses = 2, prerequisites = [[1,0]]
Output: true
Explanation: There are 2 courses to take. To take course 1 you should have finished course 0. So it is possible.

Run this challenge interactively in Python or JavaScript when the app loads.