FastPrepIn-Memory Fixed-Window Rate Limiter
Problems/In-Memory Fixed-Window Rate Limiter

In-Memory Fixed-Window Rate Limiter

Rippling logoRippling● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Rippling phone screen. The report only keeps that the Senior Full Stack AI-coding screen asked for a rate limiter. It does not keep the policy, the interface, the examples, the limits, or the follow-ups. This version uses a fixed window. Our version is about 20% the same as the reported question.

Process a batch of requests through an in-memory, per-client rate limiter. Request i belongs to clientIds[i] and arrives at timestamps[i] seconds.

Use a fixed-window policy. Time is divided into half-open windows of length windowSeconds, aligned to timestamp 0. Therefore, timestamp t belongs to window [floor(t / windowSeconds) * windowSeconds, (floor(t / windowSeconds) + 1) * windowSeconds).

Each client has an independent quota in each window:

  • Allow a request when fewer than maxRequests requests for that client have already been allowed in the same window.
  • An allowed request consumes one quota slot.
  • A rejected request does not change the limiter state.

The timestamps are nondecreasing. Requests with the same timestamp are processed in input order. Return one boolean decision for every request in the original order.

Function

applyRateLimit(clientIds: String[], timestamps: int[], maxRequests: int, windowSeconds: int) → boolean[]

Examples

Example 1

clientIds = ["alice","alice","bob","alice","alice","alice"]timestamps = [1,2,3,9,10,10]maxRequests = 2windowSeconds = 10return = [true,true,true,false,true,true]

Alice fills her two slots in window [0, 10) at timestamps 1 and 2, so her request at 9 is rejected. Bob has an independent quota. Timestamp 10 begins a new window, so both later Alice requests are allowed.

Example 2

clientIds = ["x","x","y","x","x"]timestamps = [0,4,4,5,5]maxRequests = 1windowSeconds = 5return = [true,false,true,true,false]

Client x can use one slot in [0, 5) and one new slot in [5, 10). Client y is unaffected by x's quota.

Example 3

clientIds = ["a","b","a","b","a","b"]timestamps = [7,7,7,7,7,7]maxRequests = 2windowSeconds = 3return = [true,true,true,true,false,false]

All requests share one timestamp and are processed in input order. Each client independently allows its first two requests and rejects its third.

Constraints

  • 1 <= clientIds.length == timestamps.length <= 2 * 10^5.
  • Each clientIds[i] is a nonempty printable ASCII string of length at most 50.
  • 0 <= timestamps[i] <= 10^9, and timestamps is nondecreasing.
  • 1 <= maxRequests <= 10^5.
  • 1 <= windowSeconds <= 10^9.

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

  • Config Store with Priority OverridesMicrosoft · PHONE SCREENMicrosoft interview questions
  • ID Allocator with Assign and ReleaseSnap Inc. · PHONE SCREENSnap Inc. interview questions
  • Feature Flag EvaluationCVS Health · PHONE SCREEN
  • In-Memory Key-Value Store OperationsOpenAI · PHONE SCREENOpenAI interview questions
  • LRU Cache for Query ResultsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • LRU CacheServiceNow · PHONE SCREEN · ONSITE INTERVIEWServiceNow interview questions
  • Mutable Points in a Hash Set and a ListMillennium · PHONE SCREENMillennium interview questions
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions

Rippling interview experiences

  • Rippling Senior SWE Full Loop Questions: 1 Experience
  • Rippling Experienced SWE Phone Screens: 2 Experiences
  • Rippling Design Rounds and Onsites: 17 Experiences (Part 3 of 3)
  • Rippling Phone Coding Screens: 14 Experiences (Part 2 of 3)
  • Rippling SWE Screens and Loops: 31 Experiences (Part 1 of 3)
  • Rippling No-Level Older Reports: 31 Experiences (Part 6 of 6)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public boolean[] applyRateLimit(String[] clientIds, int[] timestamps, int maxRequests, int windowSeconds) {
        // Write your code here.
    }
}
Checking account…