Maximize Evaluation Jobs Finished Before Their Deadlines

Last updated: November 29, 2026

Quick Overview

Given evaluation jobs as (duration, deadline) pairs and a single runner that executes jobs one at a time starting at time zero, return the maximum number of jobs that can be completed by their own deadlines.

OpenAI
Coding & Algorithms
Software Engineer
OpenAI
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given evaluation jobs as (duration, deadline) pairs and a single runner that executes jobs one at a time starting at time zero, return the maximum number of jobs that can be completed by their own deadlines.

Before a model launch, OpenAI teams queue many evaluation suites with different due times against limited capacity, so choosing which to run is a real scheduling call. Interviewers use this to see whether you find the exchange-argument greedy (sort by deadline, drop the longest job on overflow) and can actually justify it rather than guessing.

What the Interviewer Expects
  • Observe that a feasible set can always run in deadline order
  • Process jobs by deadline and keep a max-heap of chosen durations
  • On overflow, remove the longest chosen job and explain why that is safe
  • Prove the count stays optimal with an exchange argument
  • Validate against brute force on small inputs
Key Topics to Cover
greedy
heaps
exchange argument
scheduling with deadlines
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Each job has a value: maximize total value instead of count. Does the greedy still work?
  • There are m identical runners: what changes?
  • Jobs have release times as well as deadlines: how hard does the problem become?
  • Return which jobs to run, not just the count.
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: list of (duration, deadline) with positive durations.
  • One runner, no preemption, start at time 0, no idle time needed.
  • A job counts only if it finishes at or before its deadline.
  • Outp...
High-Level Design

If some set of jobs is feasible, it is feasible in earliest-deadline-first order, so we only need to choose the set. Scan jobs by deadline, tentatively adding each one. If the total time now exceeds t...


Submit Your Answer
Markdown supported