MEDIUMasked at 34 companies

Course Schedule

A medium-tier problem at 49% community acceptance, tagged with Depth-First Search, Breadth-First Search, Graph. Reported in interviews at Graviton and 33 others.

Founder's read

Course Schedule is a graph problem that looks simple on the surface but punishes half-baked solutions. You're given courses and their prerequisites, and you need to determine if a valid course order exists. It's been asked by 34 companies including TikTok, ByteDance, eBay, and VMware. The acceptance rate sits at 49%, which means nearly half the candidates either timeout, miss the cycle-detection angle, or build the graph wrong. The trick is recognizing this as a topological sort problem with cycle detection, not a greedy scheduling puzzle. If you freeze on this during your live assessment, StealthCoder surfaces the working solution in seconds, invisible to the proctor.

Companies asking
34
Difficulty
MEDIUM
Acceptance
49%

Companies that ask "Course Schedule"

If this hits your live OA

Course Schedule is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The problem is testing whether you can detect a cycle in a directed graph. Most candidates start with DFS or BFS and get tangled in the implementation. The gotcha: if prerequisites form a loop, no valid schedule exists, and you must return false. If no loop exists, any topological ordering works and you return true. You need to track three states per node (unvisited, visiting, visited) to catch cycles during DFS. BFS with Kahn's algorithm (in-degree approach) also works but requires careful edge handling. The common failure mode is either skipping cycle detection entirely and assuming a greedy order always works, or building the adjacency list backwards. When you hit this problem live and the DFS state machine doesn't click, StealthCoder bypasses the blank-out and hands you a proven implementation so you keep moving.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Course Schedule recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Course Schedule interview FAQ

Is Course Schedule still asked at big tech companies?+

Yes. It's in the active rotation at TikTok, ByteDance, eBay, VMware, and eight other major companies. The 49% acceptance rate means interviewers still see weak solutions regularly. It's not a showstopper problem, but it catches people who don't drill graph fundamentals.

What's the actual trick that people miss?+

Cycle detection. Candidates see prerequisites and think greedy ordering works. It doesn't. You must detect if prerequisites form a loop using DFS state tracking (unvisited, visiting, visited) or in-degree counting. Miss that and your solution fails on cyclic inputs.

DFS or BFS, which is faster?+

Both are O(V + E). DFS with state tracking is cleaner for cycle detection and what most interviewers expect. BFS with Kahn's algorithm (in-degree, queue) also works. Pick DFS if you're comfortable with recursion and state machines. Pick Kahn's if you want to avoid recursion depth issues.

How does this connect to Topological Sort?+

Course Schedule is topological sort plus cycle detection. You're ordering nodes (courses) respecting directed edges (prerequisites) while detecting if a valid order exists. Topological Sort assumes the graph is acyclic. Here you must check that assumption and return false if it fails.

Why is the acceptance rate only 49%?+

Common errors: building the adjacency list backwards, forgetting to track visiting state (causes false positives or misses cycles), implementing DFS recursion incorrectly, or timing out on large inputs due to inefficient graph construction. The problem is medium difficulty but the details matter.

Want the actual problem statement? View "Course Schedule" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.