We use optional cookies for analytics and affiliate attribution. Essential cookies and marketing measurement are always on. Read our privacy policy

We just launched our Black Friday sale. You can use code BF2026 to get 25% off all subscriptions, valid until Nov 30th. There is a limit of 100 redemptions.

Logo

Rate-Limited PubSub

What this preview is

Rate-Limited PubSub is a medium quant coding problem on language knowledge in Cpp / Python, asked at Quant.

Difficulty
Medium
Topic
Language Knowledge
Discipline
Quant development
Languages
Cpp / Python

Implementing a rate-limited publish-subscribe system

This medium-difficulty coding problem tests your ability to design and implement a distributed messaging system with rate-limiting constraints—a core concern at quantitative trading firms where market-data feeds can overwhelm downstream consumers. The challenge lies in balancing correct subscription management, efficient message delivery, and accurate rate-limit tracking across a sliding time window.

A working solution requires careful bookkeeping: maintaining subscriber-to-topic mappings, tracking message counts per subscriber within the active time window, and enforcing a global (not per-topic) rate limit. You'll need to handle window expiry correctly as time advances, manage subscriptions and unsubscriptions, and silently drop messages when a subscriber hits their quota—without affecting other subscribers to the same topic.

  • Sliding-window rate limiting and timestamp-based expiry
  • Efficient data structures for topic subscriptions and message counts
  • State management under sequential time progression
  • Edge cases: duplicate subscriptions, unsubscribe during window, window boundary conditions

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.