Skip to main content
All Questions

Design a throttling mechanism for repeated FPS game events.

Unlock detailed company stats for this questionUpgrade

In a first-person shooter, players trigger actions like shooting, reloading or throwing grenades by pressing keys, and pressing the same key repeatedly in a short period can cause excessive event triggers. Design a throttling mechanism so the same event type can only be triggered once within a given delay period. If the same event occurs again before the delay expires, it is ignored. Each event type is handled independently.

Example: delay = 5, events: [("shoot", 1), ("shoot", 2), ("reload", 3), ("shoot", 6)] -> output: [true, false, true, true].

Candidate's approach: keep a map from event type to last-triggered timestamp; allow and update when now - last >= delay, otherwise ignore. A ConcurrentHashMap handles multithreading.

Expect follow-ups like

  • Can you find a more optimal approach?

Format · Oracle Senior Software Engineer phone screen (USA).

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.