FastPrepDelayed Job Scheduler
Problems/Delayed Job Scheduler

Delayed Job Scheduler

Walmart Labs logoWalmart Labs● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names a job scheduler coding exercise without its operations or policy. Our version adds scheduling delayed jobs and polling the IDs that are ready, with rules for the clock and for ties. It is about 60% the same as the reported question.

Implement a delayed-job scheduler for a fixed list of operations. The arrays actions, jobIds, times and delays describe each operation at the same index. Process them from first to last. Start with no pending jobs. Each time in times is at least as large as the one before it.

For this exercise, assume exactly two operations:

  • SCHEDULE adds the given unique positive job ID with due time times[i] + delays[i]. Return an empty row for this operation.
  • POLL returns and removes every pending job whose due time is at most times[i]. Return IDs ordered by due time, then by the earlier SCHEDULE operation when due times tie. An empty poll returns an empty row.

Return one integer-array row per operation, including empty rows. A zero-delay job may be released by a later poll at the same clock, but never by a poll that occurred before its schedule. Jobs not reached by a poll remain pending and produce no extra output.

The finite operations, clock and tie rules are as stated. This exercise schedules and releases jobs; it does not execute job bodies or add dependencies, cancellation, priorities, recurrence or profit optimization.

Function

runJobScheduler(actions: String[], jobIds: int[], times: int[], delays: int[]) → int[][]

Examples

Example 1

actions = ["SCHEDULE","SCHEDULE","POLL","POLL"]jobIds = [1,2,0,0]times = [0,1,2,5]delays = [5,1,0,0]return = [[],[],[2],[1]]

Jobs release by due time rather than insertion.

Example 2

actions = ["SCHEDULE","SCHEDULE","POLL"]jobIds = [8,3,0]times = [0,5,10]delays = [10,5,0]return = [[],[],[8,3]]

Equal due times keep insertion order not ID order.

Example 3

actions = []jobIds = []times = []delays = []return = []

Empty operation batch.

Constraints

  • The four arrays have equal length 0 <= n <= 128.
  • Every action is "SCHEDULE" or "POLL".
  • 0 <= times[i], delays[i] <= 10^6, and times never decrease.
  • Every scheduled ID is a distinct positive integer at most 10^9 and is never reused.
  • For POLL, the unused ID and delay fields are 0.

More Walmart Labs Onsite Interview questions

  • Find the Duplicate NumberONSITE INTERVIEW · Seen Oct 2026
  • Product of Array Except SelfONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Design Authentication ManagerOracle · ONSITE INTERVIEWOracle interview questions
  • Thread-Safe Task Storage and Worker DispatchNuro · ONSITE INTERVIEWNuro interview questions
  • Notification Deduplication WindowGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Implement a Min-Priority QueueAmazon · ONSITE INTERVIEW
  • Helpdesk Ticket ProcessingThe Walt Disney Company · ONSITE INTERVIEWThe Walt Disney Company interview questions
  • Execute Tasks by PrioritySnowflake · ONSITE INTERVIEWSnowflake interview questions
  • Priority Job Scheduler with CooldownsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Order Matching EngineJane Street · ONSITE INTERVIEWJane Street interview questions
  • Trip Booking with the Earliest Free DriverRippling · ONSITE INTERVIEWRippling interview questions
  • Reusable Number AllocatorDropbox · ONSITE INTERVIEWDropbox interview questions
See Walmart Labs hiring insights
Saved
class Solution {
    public int[][] runJobScheduler(String[] actions, int[] jobIds, int[] times, int[] delays) {
        // Write your code here.
    }
}
Checking account…