PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Atlassian

Implement sliding-window rate limiter function

Last updated: May 5, 2026

Quick Overview

This question evaluates proficiency with streaming algorithms and sliding-window data structures, focusing on time-based rate limiting, efficient counting, and space/time complexity management.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Software Engineer

Implement sliding-window rate limiter function

Company: Atlassian

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Problem You are implementing a per-user rate limiter. Time is discretized into **integer time buckets** (e.g., each bucket is 1 second). You are given two parameters: - `x`: window size in buckets - `y`: maximum allowed requests within any trailing window of `x` buckets Implement: ```text boolean shouldPass(int timeBucket) ``` Each call represents an incoming request attempt at the given `timeBucket`. The function returns: - `true` if the request is allowed - `false` if the request should be rate-limited ### Rate-limit rule A request at time `t` should be allowed **iff** the number of request attempts whose bucket is in: `[t - x + 1, t]` (inclusive) is **< y** (i.e., the current request would not make it exceed `y`). **Assumption:** Even rejected attempts still count toward the limit (they are still request attempts). ### Notes / Constraints - `timeBucket` values are non-decreasing across calls. - Aim for efficient time and space usage as the number of requests grows. - Provide a few test cases (including edge cases such as repeated calls in the same bucket, large gaps between buckets, and bursts).

Quick Answer: This question evaluates proficiency with streaming algorithms and sliding-window data structures, focusing on time-based rate limiting, efficient counting, and space/time complexity management.

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)
  • Merge intervals and design rating APIs - Atlassian (medium)
  • Filter Invalid Data Events - Atlassian (easy)
Atlassian logo
Atlassian
Feb 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0
Loading...

Problem

You are implementing a per-user rate limiter. Time is discretized into integer time buckets (e.g., each bucket is 1 second).

You are given two parameters:

  • x : window size in buckets
  • y : maximum allowed requests within any trailing window of x buckets

Implement:

boolean shouldPass(int timeBucket)

Each call represents an incoming request attempt at the given timeBucket. The function returns:

  • true if the request is allowed
  • false if the request should be rate-limited

Rate-limit rule

A request at time t should be allowed iff the number of request attempts whose bucket is in:

[t - x + 1, t] (inclusive)

is < y (i.e., the current request would not make it exceed y).

Assumption: Even rejected attempts still count toward the limit (they are still request attempts).

Notes / Constraints

  • timeBucket values are non-decreasing across calls.
  • Aim for efficient time and space usage as the number of requests grows.
  • Provide a few test cases (including edge cases such as repeated calls in the same bucket, large gaps between buckets, and bursts).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Atlassian•More Software Engineer•Atlassian Software Engineer•Atlassian Coding & Algorithms•Software Engineer 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.