⚡️ Tryprepforge
Coding Round 2 Mid-Level programming

**LeetCode #207 - Course Schedule**\nThere are a total of `numCourses` courses you have to take, labeled from `0` to `numCourses-1`. Some courses may have prerequisites, represented as a list of pairs `[a, b]` meaning you must take course `b` before course `a`. Find out if you can finish all courses. Return `true` if you can finish all courses, otherwise return `false`.\n\n**Example 1:**\nInput: `numCourses = 2, prerequisites = [[1, 0]]`\nOutput: `true`\nExplanation: There are a total of 2 courses to take. To take course 1 you should have taken course 0 beforehand. Thus it is possible.\n\n**Example 2:**\nInput: `numCourses = 2, prerequisites = [[1, 0], [0, 1]]`\nOutput: `false`\nExplanation: A cycle exists.\n\n**Constraints:**\n- 0 <= numCourses <= 2000\n- 0 <= prerequisites.length <= 5000\n

Suggested Answer

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

No credit card required

More Coding Round 2 Interview Prep

Link copied to clipboard