Data Pipeline Steps with Search and Run Order
Updated
Problem statement
You manage a data pipeline made of named steps, and a step may depend on other steps. Process the operations in order and return one result string for each operation.
"add"withargs[i] = [name, dep1, dep2, ...]: if a step callednameis stored, return"exists"and change nothing. Otherwise store it with the listed dependencies and return"added". A dependency may name a step that is not stored, and a step may even list itself."search"with[prefix]: return the names of stored steps that start withprefix, in sorted order, joined by commas. Return an empty string if none match."remove"with[name]: delete that step and return"removed", or return"missing"if it is not stored. Other steps keepnamein their dependency lists."run"with[]: plan a run of all stored steps, as described below, without changing anything.
To plan a run: a step is ready once every dependency that names a stored step has run. Dependencies that name steps not stored are ignored. Repeatedly run the ready step that was added earliest; a step that was removed and added again counts from its latest add. Steps that never become ready, because they are in a dependency loop or wait on one, are blocked.
The result of "run" is the steps that ran, in run order and joined by commas, then |, then the blocked steps in sorted order and joined by commas. For example "load,clean|" means both steps ran, and "w,v|x,y,z" means x, y and z are blocked.
Sorted order means plain string order: compare two names character by character using character codes, so digits come before letters, and a name comes before any longer name that starts with it. For example, d1 comes before d10, d10 comes before d9, and a1b2 comes before abc.
Function
runPipeline(operations: String[], args: String[][]) → String[]Examples
Example 1
operations = ["add","add","add","add","search","run","remove","run"]args = [["load"],["clean","load"],["report","clean","load"],["audit","report"],["r"],[],["clean"],[]]return = ["added","added","added","added","report","load,clean,report,audit|","removed","load,report,audit|"]Four steps are added. Only report starts with r. The first run goes load, clean, report, audit, and nothing is blocked. After clean is removed, report still lists clean, but clean is not stored any more, so that dependency is ignored: the second run goes load, report, audit.
Example 2
operations = ["add","add","add","add","add","run","add","search","remove","run"]args = [["x","z"],["y","x"],["z","y"],["w"],["v","w"],[],["w"],["w"],["y"],[]]return = ["added","added","added","added","added","w,v|x,y,z","exists","w","removed","z,x,w,v|"]x waits for z, z waits for y and y waits for x: a loop. The first run can only do w and then v, so x, y and z are blocked (listed in sorted order). Adding w again returns exists. After y is removed, z is ready and so is w; z was added earlier, so it goes first. That makes x ready, and x was added before w, so x goes next. Then w and v.
Example 3
operations = ["add","add","run","remove","add","run","search","remove"]args = [["b"],["a"],[],["b"],["b"],[],["c"],["q"]]return = ["added","added","b,a|","removed","added","a,b|","","missing"]a and b have no dependencies. b was added first, so it runs first. After b is removed and added again, it counts as added after a, so a runs first. No name starts with c, so the search returns an empty string. q is not stored, so removing it returns missing.
Constraints
1 <= operations.length <= 1000andargs.length == operations.length- Each
operations[i]is"add","search","remove"or"run". - For
"add",1 <= args[i].length <= 6. For"search"and"remove",args[i].length == 1. For"run",args[i].length == 0. - Every name, dependency and prefix has 1 to 8 characters, each a lowercase letter or a digit.
- The dependency names in one
"add"are all different.
More Rippling Phone Screen questions
- Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
- Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
- Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
- Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
- Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Topological Sort with Secondary OrderingRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Lexicographically Smallest Topological OrderCoinbase · PHONE SCREENCoinbase interview questions
- Task Build Order and File-Change RerunsVanta · PHONE SCREEN
- Task Scheduler with Prerequisites and Execution PathsBrex · PHONE SCREEN
- Course Schedule IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Lexicographically Smallest Topological OrderByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
- Merge Subsequences Into a Consistent Total OrderGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Lexicographic Dependency OrderIllumio · PHONE SCREENIllumio interview questions
- Evaluate Formulas with Cycle DetectionInstacart · PHONE SCREEN · ONSITE INTERVIEWInstacart interview questions
- Order Sources by Their DependenciesRetool · PHONE SCREENRetool interview questions