FastPrepSliding-Window Rate Limiter
Problems/Sliding-Window Rate Limiter

Sliding-Window Rate Limiter

Uber logoUber● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names a well-known task. We chose the function signature, a fixed order for the output, and the input limits. Our version is about 98% the same as the reported question.

You receive requests in nondecreasing timestamp order. Each request has a user ID and an integer timestamp in seconds.

A request is accepted when that user has fewer than 100 previously accepted requests in the interval (timestamp - 60, timestamp]. Otherwise it is rejected. Rejected requests do not consume capacity. Requests with the same timestamp are processed in input order.

Return one boolean per input request, where true means accepted and false means rejected.

Function

applySlidingWindowRateLimit(userIds: String[], timestamps: int[]) → boolean[]

Examples

Example 1

userIds = ["amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy","amy"]timestamps = [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]return = [true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false]

The first 100 requests for amy fill the window. The 101st request has the same timestamp and is rejected.

Example 2

userIds = ["a","b","a","a"]timestamps = [0,0,59,60]return = [true,true,true,true]

Users have independent windows. At timestamp 60, the accepted request for a at timestamp 0 lies on the excluded lower boundary and has expired.

Constraints

  • 0 <= userIds.length <= 5000.
  • userIds.length == timestamps.length.
  • User IDs contain 1 to 50 lowercase English letters or digits.
  • 0 <= timestamps[i] <= 10^9.
  • Timestamps are nondecreasing.

Source note: Author-written prompt excerpt retained for source fidelity.

More Uber Phone Screen questions

  • Worst-Performing Ads by CTR in a Campaign TreePHONE SCREEN · Seen Nov 2026
  • Earliest Time All Users Are ConnectedPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Max Points on a LinePHONE SCREEN · Seen Oct 2026
  • Convex Function MinimizationPHONE SCREEN · Seen Oct 2026
  • Meeting Rooms IIPHONE SCREEN · Seen Oct 2026
  • Merge Meeting IntervalsPHONE SCREEN · Seen Oct 2026
  • Minimum Meeting Rooms with AssignmentsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Find Robots by Blocker DistancesPHONE SCREEN · Seen Oct 2026
  • Count Connected IslandsPHONE SCREEN · Seen Sep 2026
  • Dynamic Island CountsPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Per-Client API Rate LimiterDocker · PHONE SCREEN
  • Per-Client Sliding-Window Rate LimiterCVS Health · PHONE SCREEN
  • Recent Advertisement Click CountsAmazon · PHONE SCREEN
  • Delayed Streaming Duplicate SuppressionGoogle · PHONE SCREENGoogle interview questions
  • Completions API Rate LimiterCursor · PHONE SCREENCursor interview questions
  • Sliding-Window Rate LimiterStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Key-Value Store GET and PUT QPSDatabricks · PHONE SCREENDatabricks interview questions
  • Rate Limiter with Global and Per-User LimitsOpenAI · ONSITE INTERVIEWOpenAI interview questions
  • Per-Client Sliding-Window Rate LimiterGeneral Motors · OA
  • Metric Counter with a Fake ClockSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
All Uber interview questionsSee Uber hiring insights
Saved
class Solution {
    public boolean[] applySlidingWindowRateLimit(String[] userIds, int[] timestamps) {
        // Write your solution here.
    }
}
Checking account…