Question - Create a RateLimiter such that e.g. 3 QPS are allowed, so duration becomes 1 second. Though during interviews, one should be creating this in simple way to avoid any complications. Even I feel such questions are useless to ask when you will never be working on such problem with lots of libraries already existing.
Still, I tried to write some code for this & it took me many hours-
Still, I tried to write some code for this & it took me many hours-
Rate Limiter
For the interview purpose one can try below simpler approach-
SimpleRatelimiterPOC