FastPrepEarliest Dataset Readiness in a Pipeline
Problems/Earliest Dataset Readiness in a Pipeline

Earliest Dataset Readiness in a Pipeline

xAI logoxAI● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview prompt defines tasks that consume datasets, produce one dataset, and run in parallel once all inputs exist. It asks for the earliest time a target dataset can be ready. Our version is about 98% the same as the reported question.

You are given a data pipeline containing n tasks. Task i consumes every dataset in taskInputs[i], produces taskOutputs[i], and takes durations[i] time units after it starts.

A dataset that is consumed but is not produced by any task is an external input and is available at time 0. A task starts as soon as all its input datasets are available. Tasks have unlimited parallel workers, so one task never delays an otherwise-ready task. Its output becomes available exactly durations[i] time units after it starts.

Return the earliest time when targetDataset is available. The target may itself be an external input.

Function

earliestDatasetReadyTime(taskInputs: String[][], taskOutputs: String[], durations: int[], targetDataset: String) → int

Examples

Example 1

taskInputs = [["d0","d1","d2"],["d1","d2"],["d2","d3"],["d0","d3","d4"]]taskOutputs = ["d3","d4","d5","d6"]durations = [30,15,100,60]targetDataset = "d6"return = 90

d3 and d4 finish at times 30 and 15. The task producing d6 waits for both, starts at 30, and finishes at 90. The slower d5 branch is irrelevant to the target.

Example 2

taskInputs = [["seed"],["a"]]taskOutputs = ["a","b"]durations = [10,20]targetDataset = "seed"return = 0

seed is not produced by a task, so it is an external dataset available at time 0.

Constraints

  • 1 <= n <= 200000.
  • taskInputs.length == taskOutputs.length == durations.length == n.
  • 1 <= taskInputs[i].length, and the total number of consumed-dataset entries is at most 400000.
  • Every task output name is unique, and all dataset names are nonempty printable ASCII strings of length at most 50.
  • 1 <= durations[i] <= 10000.
  • The task dependency graph is acyclic.
  • The earliest target readiness time fits in a signed 32-bit integer.

More xAI interview questions

  • Resumable List IteratorPHONE SCREEN · Seen Apr 2026
  • Most Common N-GramsPHONE SCREEN · Seen Mar 2025
  • Double-Base PalindromesPHONE SCREEN · Seen Oct 2024
  • Live Top-K Spaces by Active UsersONSITE INTERVIEW · Seen Jan 2026
  • Total Active Time by SpaceONSITE INTERVIEW · Seen Jan 2026
  • Dynamic Batch Decode TraceONSITE INTERVIEW · Seen Dec 2025
  • Nested Transaction Key-Value StoreONSITE INTERVIEW · Seen Oct 2025
  • Weighted LRU CacheONSITE INTERVIEW · Seen Oct 2025
  • LFU CacheONSITE INTERVIEW · Seen Sep 2025
  • Cached Lazy Token BucketsONSITE INTERVIEW · Seen Sep 2025

Similar questions at other companies

  • All Halfway Courses Across Course TracksCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Minimum Completion Time for DAG DependenciesAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Work Order Critical PathHadrian · PHONE SCREENHadrian interview questions
  • Longest Name Chain in a Directed Acyclic GraphOscar Health · PHONE SCREEN
  • Service Dependency Load FactorsRobinhood · PHONE SCREENRobinhood interview questions
  • Longest Chain BookingAirbnb · PHONE SCREENAirbnb interview questions
  • Critical Path Through Dependent TasksModular · PHONE SCREEN · ONSITE INTERVIEW
  • Longest Path in a Directed Acyclic GraphSuno · PHONE SCREEN
  • Select Transactions with Child-Pays-for-Parent PackagesCoinbase · PHONE SCREENCoinbase interview questions
  • Choose a Road to Maximize Average Route Toll IncreaseHarness · PHONE SCREEN

xAI interview experiences

  • xAI New Grad AI Coding Interview and Take-Home: 3 Experiences
All xAI interview questionsSee xAI hiring insights
Saved
class Solution {
    public int earliestDatasetReadyTime(String[][] taskInputs, String[] taskOutputs, int[] durations, String targetDataset) {
        // Write your code here.
    }
}
Checking account…