Course Schedule III
A hard-tier problem at 41% community acceptance, tagged with Array, Greedy, Sorting. Reported in interviews at Works Applications and 1 others.
Course Schedule III is the hard problem that catches people off guard because the greedy solution isn't obvious on first read. You're given courses with deadlines and durations, and you need to fit the maximum number of courses before each deadline expires. Works Applications and Flipkart ask this regularly. The acceptance rate sits around 41%, meaning most people either TLE with a naive approach or lock up trying to figure out why greedy works here. If you hit this live and freeze on the insight, StealthCoder solves it invisibly during the assessment.
Companies that ask "Course Schedule III"
Course Schedule III 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. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe trick is sorting by deadline first, then greedily adding courses while tracking total time. If adding a course would exceed its deadline, don't just skip it, boot the longest course you've already scheduled and try again. This works because you're using a max heap to always drop the heaviest burden, not the most recent one. Most people try to simulate the schedule or sort wrong, which kills runtime. The pattern: greedy + heap together solve what sorting alone can't. If you've drilled array and sorting but never seen heap used this way in a greedy context, StealthCoder is your safety net when the pattern doesn't click during the live OA.
Pattern tags
You know the problem.
Make sure you actually pass it.
Course Schedule III recycles across companies for a reason. It's hard-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. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Course Schedule III interview FAQ
Why is greedy the right approach here?+
You want to maximize course count, and sorting by deadline lets you prioritize what's urgent. Greedy works because swapping a longer course for a shorter one never hurts your ability to fit future courses. The key insight is that the heap lets you make that swap in real time, not retroactively.
What breaks if you sort by duration instead of deadline?+
You'll fit short courses first, but you'll miss deadlines on longer courses that came earlier. Deadline-sorted order ensures you respect the time windows. Duration sorting doesn't encode urgency at all.
How does the heap part actually work in this problem?+
As you iterate through courses in deadline order, you add each course to your schedule. If the total time exceeds the deadline, you use the max heap to pop the longest course you've added so far. This keeps your schedule feasible without backtracking.
Is this still asked at Flipkart and Works Applications?+
Yes, both companies report asking Course Schedule III. It's a hard-tier problem, so expect it in later-stage interviews or as a screen. The 41% acceptance rate suggests it's not a gimme, even at experienced levels.
What topics should I review before tackling this?+
Sorting and greedy algorithm design are foundational. You also need to be comfortable with max heap operations in your language. If heap syntax isn't second nature, Practice that before trying to optimize the algorithm logic.
Want the actual problem statement? View "Course Schedule III" on LeetCode →