Phone screen: a sliding window rate limiter, plus some system design questions related to the rate limiter. The prompt was:
// Implement a sliding-window rate limiter that restricts how many requests a client
// can make within a rolling time window.
// Requirements:
// - Per-client tracking: each client has an independent request count.
// - Sliding time window: only requests within the configured window count toward the limit.
// - Allow / deny: return whether a request is allowed and record it when allowed.
// - Handle concurrent requests (thread-safe).
// - Be memory-efficient (prune expired timestamps).
Virtual onsite
Round 1, coding: a hashmap, a set and a priority queue should be enough to solve it. Two functions:
Insert(campaign): void
query(bidrequest): campaign
query should return the campaign with the highest bid price for matching demographics and ad format.
Round 2, BQ: some simple behavioral questions. This round felt more like a chat.
Round 3, system design: design Reddit. They asked how to do the schema, how to partition, how to scale, and so on, with all kinds of follow-ups. I felt I did not answer this one well, and I think I probably failed here.
Discussion
Loading comments…