PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Atlassian

Implement sliding-window rate limiter with dual thresholds

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's skill in implementing efficient online sliding-window rate limiting, covering stream processing, time-based window management, per-key state maintenance, algorithmic complexity analysis, and formal correctness reasoning.

  • Medium
  • Atlassian
  • Coding & Algorithms
  • Data Scientist

Implement sliding-window rate limiter with dual thresholds

Company: Atlassian

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

Implement getRequestStatus(urls: List[str]) -> List[str]. The i-th entry in urls represents a single incoming request at timestamp t = i seconds (t starts at 0); the value is the URL being requested. For each request, return '200' if it can be served, else '429' if serving it would violate either limit for that same URL: at most 2 successful requests in any sliding 5-second window [t-4, t], and at most 5 successful requests in any sliding 30-second window [t-29, t]. Important: rejected requests must NOT be recorded as successful and therefore must NOT count toward future windows; successful requests do count. Process the stream online in arrival order. Constraints: 0 ≤ n ≤ 2e5; URLs are arbitrary strings; target O(1) amortized time per event and O(U) memory, where U is the number of distinct URLs seen in the past 30 seconds only. Use only built-in data structures; avoid third-party rate-limiting libraries. Provide: 1) A correct, production-friendly implementation that uses per-URL deques (or equivalent) to maintain only the timestamps still inside the respective windows; 2) Proof of correctness with respect to the two sliding-window constraints and the reject-does-not-count semantics; 3) Tight time and space complexity analysis; 4) Unit tests that cover edge cases such as empty input, alternating URLs, bursts exactly at boundaries (t=4/5 and t=29/30), rapid sequences that flip between '200' and '429', and very long runs where old timestamps must be evicted efficiently.

Quick Answer: This question evaluates a candidate's skill in implementing efficient online sliding-window rate limiting, covering stream processing, time-based window management, per-key state maintenance, algorithmic complexity analysis, and formal correctness reasoning.

Related Interview Questions

  • Find a secret word using match feedback - Atlassian (hard)
  • Compute a moving average on a stream - Atlassian (hard)
  • Implement sequential and parallel URL requests - Atlassian (medium)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)
Atlassian logo
Atlassian
Oct 13, 2025, 9:49 PM
Data Scientist
Take-home Project
Coding & Algorithms
5
0

Implement getRequestStatus(urls: List[str]) -> List[str]. The i-th entry in urls represents a single incoming request at timestamp t = i seconds (t starts at 0); the value is the URL being requested. For each request, return '200' if it can be served, else '429' if serving it would violate either limit for that same URL: at most 2 successful requests in any sliding 5-second window [t-4, t], and at most 5 successful requests in any sliding 30-second window [t-29, t]. Important: rejected requests must NOT be recorded as successful and therefore must NOT count toward future windows; successful requests do count. Process the stream online in arrival order. Constraints: 0 ≤ n ≤ 2e5; URLs are arbitrary strings; target O(1) amortized time per event and O(U) memory, where U is the number of distinct URLs seen in the past 30 seconds only. Use only built-in data structures; avoid third-party rate-limiting libraries. Provide: 1) A correct, production-friendly implementation that uses per-URL deques (or equivalent) to maintain only the timestamps still inside the respective windows; 2) Proof of correctness with respect to the two sliding-window constraints and the reject-does-not-count semantics; 3) Tight time and space complexity analysis; 4) Unit tests that cover edge cases such as empty input, alternating URLs, bursts exactly at boundaries (t=4/5 and t=29/30), rapid sequences that flip between '200' and '429', and very long runs where old timestamps must be evicted efficiently.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Atlassian•More Data Scientist•Atlassian Data Scientist•Atlassian Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.