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)] gives [true, false, true, true].
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

Course
Course
