FastPrepCan You Finish All Courses?
Problems/Can You Finish All Courses?

Can You Finish All Courses?

Intuit logoIntuit● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit new grad online assessment. The report names the well-known Course Schedule problem. It describes building a graph, counting incoming edges, and starting with courses that have zero incoming edges.

This version uses the named task's question of whether it is possible, and returns a Boolean. Courses are numbered from 0, every listed prerequisite is required, and cycles prevent completion. It does not return a course order.

Our version is about 95% the same as the named exercise.

There are numCourses courses, numbered from 0 through numCourses-1. Each row [course, prerequisite] in prerequisites means the prerequisite must be completed before that course.

Return true if all courses can be completed, and false otherwise. A course may require several prerequisites, and every one of them must be completed first. Courses absent from the pair list still exist and have no listed prerequisites.

A directed cycle, including a self-prerequisite, makes completion impossible. Return only the feasibility decision, not a course order.

Function

canFinish(numCourses: int, prerequisites: int[][]) → boolean

Examples

Example 1

numCourses = 2prerequisites = [[1,0]]return = true

Complete course 0 first and then course 1. That order satisfies the only prerequisite, so both courses can be completed.

Example 2

numCourses = 2prerequisites = [[1,0],[0,1]]return = false

Course 1 waits for course 0, and course 0 waits for course 1. Neither can start, so completing all courses is impossible.

Constraints

  • 1 <= numCourses <= 2000.
  • 0 <= prerequisites.length <= 5000.
  • Every prerequisite row contains exactly two integers, each from 0 through numCourses-1.
  • All prerequisite pairs are unique.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Course SchedulePlaud · ONSITE INTERVIEW
  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Course ScheduleNykaa · PHONE SCREENNykaa interview questions
  • Course ScheduleFlexTrade · ONSITE INTERVIEWFlexTrade interview questions
  • Course ScheduleBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Course Schedule FeasibilityTesla · PHONE SCREENTesla interview questions
  • Can All Courses Be FinishedC3.ai · ONSITE INTERVIEWC3.ai interview questions
  • Trace Terminal Company OwnershipPalantir · ONSITE INTERVIEWPalantir interview questions
  • Distances to CyclesBelvedere Trading · OA
  • Minimum Cleaning Robot RunsHSBC · OAHSBC interview questions

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public boolean canFinish(int numCourses, int[][] prerequisites) {
        // Write your code here
    }
}
Checking account…