FastPrepCourse Schedule
Problems/Course Schedule

Course Schedule

ByteDance logoByteDance● MediumFULLTIMENEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report names the task but does not give the exact result, the function, the examples or the limits. Our version is about 82% the same as the reported question.

There are numCourses courses labeled from 0 through numCourses - 1. Each pair [course, prerequisite] means that prerequisite must be completed before course.

Return true if it is possible to complete every course. Return false when the prerequisite graph contains a directed cycle.

Function

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

Examples

Example 1

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

Course 0 can be completed before course 1.

Example 2

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

Each course requires the other first, so the graph contains a cycle.

Example 3

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

One valid completion order is 0, 1, 2, 3.

Constraints

  • 1 <= numCourses <= 2000
  • 0 <= prerequisites.length <= 5000
  • Every prerequisite pair contains two distinct valid course labels.
  • No prerequisite pair appears more than once.

More ByteDance Phone Screen questions

  • Largest Number Below N from Reusable DigitsPHONE SCREEN · Seen Nov 2026
  • Log Analyzer: Busiest Service in a Rolling WindowPHONE SCREEN · Seen Nov 2026
  • Majority ElementPHONE SCREEN · Seen Nov 2026
  • Valid ParenthesesPHONE SCREEN · Seen Nov 2026
  • Binary Tree Target-Sum PathsPHONE SCREEN · Seen Nov 2026
  • Longest Increasing SubsequencePHONE SCREEN · Seen Nov 2026
  • Alien DictionaryPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lexicographically Smallest Topological OrderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Maximum Number of Events That Can Be AttendedPHONE SCREEN · Seen Nov 2026
  • Implement Multi-Head AttentionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Course ScheduleNykaa · PHONE SCREENNykaa interview questions
  • Topological Sort for Ads TasksNetflix · PHONE SCREENNetflix interview questions
  • Course ScheduleBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Hubs With the Shortest Longest ChainAdobe · PHONE SCREENAdobe interview questions
  • Task Order With PrerequisitesDoorDash · PHONE SCREEN · ONSITE INTERVIEWDoorDash interview questions
  • Course Schedule FeasibilityTesla · PHONE SCREENTesla interview questions
  • Job Schedule with One Initial Ready JobDatadog · PHONE SCREENDatadog interview questions
  • Course SchedulePlaud · ONSITE INTERVIEW
  • Find a Valid Course Completion OrderGoogle · ONSITE INTERVIEWGoogle interview questions

ByteDance interview experiences

  • ByteDance TikTok USDS SWE Intern Interview: 1 Experience
  • ByteDance MLE New Grad Interviews: 1 Experience
  • ByteDance Security SRE Intern Phone Screens: 1 Experience
  • ByteDance USDS New Grad SWE Phone Screen: 1 Experience
  • ByteDance New Grad Data Engineer Video Interviews: 1 Experience
  • ByteDance Trust & Safety Research Scientist Intern: 1 Experience
All ByteDance interview questionsSee ByteDance hiring insights
Saved
class Solution {
    public boolean canFinish(int numCourses, int[][] prerequisites) {
        // Write your solution here
    }
}
Checking account…