FastPrepDelayed Task Executor Ordering
Problems/Delayed Task Executor Ordering

Delayed Task Executor Ordering

Temporal logoTemporal● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two Temporal phone-screen posts from the same candidate, dated May 8 and May 9, 2025, describe implementing a delayed executor. A follow-up clearly contrasts busy waiting with condition wait and notify. The later post is the single date for this sighting. Here, arrays stand in for the real timing, so the answer is always the same. Our version is about 94% the same as the reported question.

A delayed executor accepts tasks at their submission times and makes each task runnable at submitTimes[i] + delays[i].

In this practice version, return task IDs in execution order: earlier runnable time first, breaking equal runnable times by the original submission index.

A production implementation should wait on a condition variable for the earliest deadline, wake when a new earlier task is submitted, and avoid polling or sleeping while holding a lock.

Function

delayedExecutionOrder(taskIds: String[], submitTimes: long[], delays: long[]) → String[]

Examples

Example 1

taskIds = ["a","b","c"]submitTimes = [0,2,4]delays = [10,1,3]return = ["b","c","a"]

The runnable times are 10, 3, and 7.

Example 2

taskIds = ["first","second","third"]submitTimes = [0,1,2]delays = [5,4,3]return = ["first","second","third"]

All deadlines equal 5, so original indices break the tie.

Example 3

taskIds = ["only"]submitTimes = [100]delays = [0]return = ["only"]

The only task executes at its submission time.

Constraints

  • 1 <= taskIds.length == submitTimes.length == delays.length <= 200000.
  • Task IDs are unique non-empty strings.
  • 0 <= submitTimes[i], delays[i] <= 10^12, and each sum fits in a signed 64-bit integer.

More Temporal interview questions

  • Concurrent Volley ShotPHONE SCREEN · Seen Apr 2026
  • Normalize and Aggregate Error LogsPHONE SCREEN · Seen Feb 2026
  • Concurrent Web Crawler ReachabilityPHONE SCREEN · Seen Oct 2025
  • Game of Life Next GenerationONSITE INTERVIEW · Seen Oct 2025

Similar questions at other companies

  • Top K With a Deterministically Noisy Comparator (MLE)Mercor · ONSITE INTERVIEWMercor interview questions
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Top K Frequent ElementsAmazon · OA · PHONE SCREEN
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Streaming Median of Trade PricesXantium · PHONE SCREEN
  • Top K Pins with Insert and QueryPinterest · PHONE SCREENPinterest interview questions
  • Top K Movies by Play Count from CSV DataTubi · PHONE SCREEN
  • Alert Engine with a Repeat IntervalChronosphere · PHONE SCREEN
  • Finish Time of Fixed-Length CPU TasksGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
All Temporal interview questionsSee Temporal hiring insights
Saved
class Solution {
    public String[] delayedExecutionOrder(String[] taskIds, long[] submitTimes, long[] delays) {
        // Write your code here.
    }
}
Checking account…