FastPrepRun Tasks with a Concurrency Limit
Problems/Run Tasks with a Concurrency Limit

Run Tasks with a Concurrency Limit

Rippling logoRippling● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Every rule here is our choice. Jobs start in input order, each one as soon as its item has arrived and fewer than limit jobs are running. A job that ends at time T frees its slot at T, so another job can start at that same moment, and jobs that can start at the same moment go in input order. Each job reports its start and finish time. The arrival times, the names, the limits and the examples are ours too.

The report, from a rescheduled first round, names mapLimit as a task and adds a follow-up about streaming input. It gives no signature, rules or examples for either part.

This version checks when each job starts and ends. It does not check JavaScript code: neither a higher-order mapLimit that takes an async function and hands back results through a callback or a promise, nor code that reads a real stream. The arrival times only stand in for the stream follow-up. The editorial covers both.

Our version is about 40% the same as the reported question.

A helper like mapLimit runs an async job for each item of a list, but never more than limit jobs at the same time. Here the items come in as a stream: item i arrives at time arrivals[i], and its job takes durations[i] time units.

Jobs start in input order. Job i starts at the earliest time when all of these are true:

  • item i has arrived,
  • job i - 1 has started (when i > 0), and
  • fewer than limit jobs are running.

A job that starts at time s runs until s + durations[i]. A job that finishes at time T is no longer running at T, so its slot can start another job at T. When several jobs can start at the same moment, they start in input order.

Return one row [start, finish] for each job, in input order.

Function

scheduleWithLimit(arrivals: int[], durations: int[], limit: int) → int[][]

Examples

Example 1

arrivals = [0,0,0,0,0]durations = [4,2,3,1,5]limit = 2return = [[0,4],[0,2],[2,5],[4,5],[5,10]]

All five jobs are ready at time 0, and two may run at once. Jobs 0 and 1 start at 0. Job 1 ends at 2, so job 2 starts at 2 and ends at 5. Job 0 ends at 4, so job 3 starts at 4 and ends at 5. Two jobs end at 5, and job 4 starts then and ends at 10. All work is done at time 10.

Example 2

arrivals = [0,1,1,6,6]durations = [3,3,1,2,2]limit = 2return = [[0,3],[1,4],[3,4],[6,8],[6,8]]

Job 0 starts at 0 and job 1 starts when it arrives at 1. Job 2 also arrives at 1, but both slots are busy until job 0 ends at 3, so it runs from 3 to 4. Nothing runs from 4 to 6. Jobs 3 and 4 arrive at 6 and start at once.

Example 3

arrivals = [0,0,4]durations = [4,4,2]limit = 2return = [[0,4],[0,4],[4,6]]

Jobs 0 and 1 end at 4. A job that ends at 4 frees its slot at 4, so job 2, which arrives at 4, starts at 4.

Constraints

  • 1 <= arrivals.length <= 1000 and durations.length == arrivals.length
  • 0 <= arrivals[i] <= 10^6, and arrivals is sorted in non-decreasing order
  • 1 <= durations[i] <= 10^6
  • 1 <= limit <= 1000

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

  • ID Allocator with Assign and ReleaseSnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Last Robot ScoreNVIDIA · PHONE SCREENNVIDIA interview questions
  • Allocate and Reuse Server Names by TypeStripe · PHONE SCREENStripe interview questions
  • Alert Engine with a Repeat IntervalChronosphere · PHONE SCREEN
  • Finish Time of Fixed-Length CPU TasksGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Timer Job Scheduler Wake-upsRedNote · PHONE SCREEN
  • Shortest-Job-First Process SchedulingByteDance · PHONE SCREENByteDance interview questions
  • Key-Value Store on a Block DeviceLambda · PHONE SCREEN
  • 15-Minute Chat Session TrackerOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Lazy K-Way Union IteratorMongoDB · PHONE SCREENMongoDB interview questions

Interview reports that mention this question

  • Rippling Frontend, Mobile, Data: 18 Experiences (Part 12 of 12)
  • Rippling Full-Time SWE Interviews: 224 Experiences (Part 1 of 12)

Rippling interview experiences

  • Rippling No-Level Older Reports: 31 Experiences (Part 6 of 6)
  • Rippling No-Level Onsite Loops: 24 Experiences (Part 5 of 6)
  • Rippling No-Level Screens and Loops: 18 Experiences (Part 4 of 6)
  • Rippling No-Level Coding Screens: 37 Experiences (Part 3 of 6)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int[][] scheduleWithLimit(int[] arrivals, int[] durations, int limit) {
        // Write your code here.
    }
}
Checking account…