45 minutes of coding + SD. It seems like there's no Karat anymore? The interviewer was also a current Atlassian employee.
Coding
Implement a simple rate limiter, assume all input values are valid.
Part 1: check(time_bucket: int) -> bool
The time bucket never decreases. Each call to this function counts as one more request in that time bucket. If the number of requests in the time bucket is greater than the limit, return false.
Part 2: check(time_bucket: int, caller_id: str) -> bool
Within a time bucket there are different callers, and you only return false if that particular caller's requests exceed the limit.
After finishing each part you have to write simple test cases. Only test the happy path.
SD
Part 1: On the whiteboard, draw what components a simple rate limiter service needs to include.
Part 2: What if the number of users grows? How do you scale up, what problems will you run into, and how do you solve them?
Part 3: What if you want the rate limiter to be more precise? How would you do it, and what are the tradeoffs?
Discussion
Loading comments…