Grokking 75: Top Coding Interview Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Course Schedule (medium)
On this page

Problem Statement

You have to complete a numCourses number of courses, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [a<sub>i</sub>, b<sub>i</sub>] indicates that you must complete course b<sub>i</sub> first if you want to complete course a<sub>i</sub>.

Return true if it's possible to finish all the courses given these prerequisites. Otherwise, return false.

Examples

Example 1:

  • Input: numCourses = 3, prerequisites = [[2, 0], [2, 1]]
  • Expected Output: true

.....

.....

.....

Like the course? Get enrolled and start learning!

On this page