Reported July 2024
Skydiosliding window

Drone API Sliding-Window Rate Limiter

Reported by candidates from Skydio's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Skydio OA. Under 2s to a working solution.
Founder's read

Skydio reportedly put a per-drone rate limiter in front of candidates in July 2024, and the input size is the first thing to read. Up to 100000 requests means rescanning every earlier request for each new one will crawl. This is a sliding window per key, with a hash map holding a queue of accepted timestamps for each drone. Timestamps come in sorted, so old entries only ever leave from the front. If you've got an OA coming, this is a clean one to rehearse once. StealthCoder sits invisibly on your screen as a safety net if you blank on the details during the live assessment.

The problem

Requests arrive in nondecreasing timestamp order. Request i comes from droneIds[i] at integer time timestamps[i].
Each drone may have at most maxRequests accepted requests in the inclusive interval [timestamps[i] - windowSeconds + 1, timestamps[i]]. A rejected request does not consume quota. Return one boolean per request indicating whether it is accepted.

Function
allowDroneRequests(droneIds: String[], timestamps: int[], windowSeconds: int, maxRequests: int) → boolean[]

Examples
Example 1
droneIds = ["d1","d1","d1","d1"]
timestamps = [1,2,3,4]
windowSeconds = 3
maxRequests = 2
return = [true,true,false,true]
The request at time 3 exceeds d1's quota; at time 4, the accepted request at time 1 has left the window.
Example 2
droneIds = ["d1","d2","d1"]
timestamps = [5,5,5]
windowSeconds = 10
maxRequests = 1
return = [true,true,false]
Each drone has independent quota state.

Constraints
The arrays have the same length from 0 through 100000.
Timestamps are nonnegative and nondecreasing.
1 <= windowSeconds, maxRequests <= 100000.
Drone IDs are non-empty ASCII strings.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to store only accepted timestamps, per drone, in a deque. For each request, pop from the front while the front is less than or equal to timestamp - windowSeconds. That's the inclusive window edge: the window is [t - w + 1, t], so anything at t - w or earlier is gone. Then if the deque size is below maxRequests, accept and push the timestamp. Otherwise reject and push nothing. Pitfalls: pushing rejected requests (the problem says they don't consume quota), an off-by-one on the window boundary, and sharing one queue across all drones. Example 1 catches the boundary bug at time 4. Each timestamp is pushed and popped at most once, so the total is O(n). If the boundary logic slips under pressure, StealthCoder is the hedge during the live OA.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Drone API Sliding-Window Rate Limiter cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Skydio's OA.

Skydio reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Drone API Sliding-Window Rate Limiter FAQ

What's the trick in the Skydio rate limiter problem?+

Keep a hash map from drone ID to a deque of accepted timestamps. Before each decision, evict timestamps at or before t - windowSeconds. Accept if the deque is under maxRequests. Since input is sorted by time, eviction only happens at the front, so everything stays linear.

Why does the window boundary trip people up?+

The interval is inclusive: [t - windowSeconds + 1, t]. So a request at t - windowSeconds is already outside. In Example 1, with window 3, the request at time 1 is out by time 4. Using t - windowSeconds < front instead of <= gives wrong answers.

Do rejected requests count toward the quota?+

No. The statement says a rejected request does not consume quota. Only push the timestamp onto the deque when you accept. Pushing rejected ones inflates the count and makes later requests fail incorrectly, which is the most common wrong answer here.

What's the time complexity and does it fit the constraints?+

O(n) total, since each accepted timestamp is added once and removed at most once. Space is O(n) in the worst case across all drones. With n up to 100000, a naive rescan per request is O(n^2) and risks timing out, so the deque approach is what you want.

How should I prepare for this in 48 hours?+

Write the per-key deque solution from scratch once, then test the edge cases: empty arrays, multiple drones at the same timestamp, and the inclusive boundary. Run both examples by hand. Related sliding-window-per-key problems like hit counters and logger rate limiters use the same structure.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Skydio.

OA at Skydio?
Invisible during screen share
Get it