FastPrepToken Bucket Request Decisions
Problems/Token Bucket Request Decisions

Token Bucket Request Decisions

Plaid logoPlaid● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Plaid onsite interview. The report describes a rate-limiter exercise that moves on to queue overflow and a simulation of bucket throughput. It does not give the exact clock for refills or how the output is written. Our version is about 91% the same as the reported question.

Simulate a token-bucket rate limiter for requests arriving at integer-second timestamps.

For this exercise, assume the bucket starts full with capacity tokens. Immediately before each request, add refillRate tokens for every whole second elapsed since the previous request, capped at capacity. A request is allowed and consumes one token when a token is available; otherwise it is rejected. Process requests in the supplied nondecreasing order and return one decision per request.

Function

allowRequests(arrivalTimes: int[], capacity: int, refillRate: int) → boolean[]

Examples

Example 1

arrivalTimes = [0,0,0,1]capacity = 2refillRate = 1return = [true,true,false,true]

The first two requests consume the initial tokens. The third is rejected, and one token refills before the request at time 1.

Example 2

arrivalTimes = [1,2,10]capacity = 1refillRate = 1return = [true,true,true]

At least one second separates every pair of requests, so the one-token bucket refills before each request.

Constraints

  • 1 <= arrivalTimes.length <= 10^5
  • 0 <= arrivalTimes[i] <= 10^9
  • arrivalTimes is nondecreasing.
  • 1 <= capacity, refillRate <= 10^6

More Plaid interview questions

  • Validate and Resolve Evaluation ChainsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Bounded Token-Bucket Request QueueONSITE INTERVIEW · Seen Jul 2026
  • Automation Pipeline, Part 1: Single WorkerPHONE SCREEN · Seen Nov 2026
  • Total Pipeline Completion TimePHONE SCREEN · Seen Sep 2026
  • Rule References: Validity and EligibilityPHONE SCREEN · Seen Aug 2026
  • Automation Pipeline, Part 3: Stage DurationPHONE SCREEN · Seen Jul 2026
  • Automation Pipeline, Part 2: Stage WorkersPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Concurrent Buffered File LoggerDatabricks · ONSITE INTERVIEWDatabricks interview questions
  • Priority Message BufferAmazon · ONSITE INTERVIEW
  • Five-Minute Hit CounterGoogle · ONSITE INTERVIEWGoogle interview questions
  • Sliding-Window API Rate LimiterPatreon · PHONE SCREEN · ONSITE INTERVIEWPatreon interview questions
  • Sliding-Window Rate LimiterSnowflake · ONSITE INTERVIEWSnowflake interview questions
  • Bounded Producer–Consumer QueueMakeMyTrip.com · ONSITE INTERVIEWMakeMyTrip.com interview questions
  • Rate Limiter Sliding Window With Per-Entity LimitsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • First Unique ID in a StreamDoorDash · ONSITE INTERVIEWDoorDash interview questions
  • Metric Counter with a Fake ClockSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Per-Client Sliding-Window Rate LimiterNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions

Plaid interview experiences

  • Plaid interviews · November 2026
  • Plaid OA · November 2026
All Plaid interview questionsSee Plaid hiring insights
Saved
class Solution {
    public boolean[] allowRequests(int[] arrivalTimes, int capacity, int refillRate) {
        // Your code here
    }
}
Checking account…