FastPrepCourse Schedule
Problems/Course Schedule

Course Schedule

Oracle logoOracle● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Oracle onsite loop for a senior platform software engineer role in India. The first coding round had a course scheduling question that was meant to be solved with topological sort.

The report named the question but gave no statement, examples or limits. Here you get the usual version: given the courses and the pairs that say which course comes first, return whether every course can be finished. The report does not say whether you also had to return the order. The editorial shows how to do that, but it is not tested.

Our version is about 70% the same as the reported question.

Given numCourses courses and a list of prerequisites, return true if you can finish every course, or false if you cannot.

The courses are labeled from 0 to numCourses - 1. Each pair prerequisites[i] = [a, b] means you must finish course b before you can take course a. You may take the courses in any order that keeps every pair.

Function

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

Examples

Example 1

numCourses = 5prerequisites = [[2,0],[2,1],[4,2],[3,1]]return = true

Courses 0 and 1 need nothing. Take 0, then 1, then 2 (it needs 0 and 1), then 3 (it needs 1), then 4 (it needs 2). Every course gets finished.

Example 2

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

Course 1 needs course 3, course 3 needs course 2, and course 2 needs course 1. These three courses wait on each other, so none of them can ever be taken. Only course 0 can be finished.

Example 3

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

The pair [2, 2] says course 2 must be finished before course 2 itself, which is impossible. Courses 0 and 1 can be taken, but course 2 never can.

Constraints

  • 1 <= numCourses <= 2000
  • 0 <= prerequisites.length <= 5000
  • prerequisites[i].length == 2
  • 0 <= prerequisites[i][j] < numCourses
  • All pairs in prerequisites are distinct.

More Oracle Onsite Interview questions

  • Shortest Subarray with Sum at Least KONSITE INTERVIEW · Seen Nov 2026
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Minimum Meeting RoomsONSITE INTERVIEW · Seen Nov 2026
  • Shortest Window with Required CountsONSITE INTERVIEW · Seen Nov 2026
  • Maximum Subarray Sum with One DeletionONSITE INTERVIEW · Seen Nov 2026
  • Shortest Deletion for Distinct CharactersONSITE INTERVIEW · Seen Nov 2026
  • Count Dropped Rate-Limited RequestsONSITE INTERVIEW · Seen Nov 2026
  • Design Authentication ManagerONSITE INTERVIEW · Seen Oct 2026
  • Maximum Bouquet ValueONSITE INTERVIEW · Seen Oct 2026
  • Cache an Expensive Service Across ThreadsONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Course SchedulePlaud · ONSITE INTERVIEW
  • Course ScheduleFlexTrade · ONSITE INTERVIEWFlexTrade interview questions
  • Course ScheduleBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Can All Courses Be FinishedC3.ai · ONSITE INTERVIEWC3.ai interview questions
  • Trace Terminal Company OwnershipPalantir · ONSITE INTERVIEWPalantir interview questions
  • Course ScheduleNykaa · PHONE SCREENNykaa interview questions
  • Course Schedule FeasibilityTesla · PHONE SCREENTesla interview questions
  • Can You Finish All Courses?Intuit · OAIntuit interview questions
  • Package Install OrderVerily · ONSITE INTERVIEW

Oracle interview experiences

  • Oracle SWE Onsite Interview Experience: 1 Experience
All Oracle interview questionsSee Oracle hiring insights
Saved
class Solution {
    public boolean canFinish(int numCourses, int[][] prerequisites) {
        // Write your code here.
    }
}
Checking account…