Event Emitter
A medium-tier problem at 74% community acceptance, tagged with . Reported in interviews at Tinkoff and 2 others.
Event Emitter is a 70% acceptance-rate system design problem that tests your ability to build a publish-subscribe pattern from scratch. Tinkoff, Box, and Yandex ask it. Most candidates know the concept but fumble the implementation details: edge cases around listener removal, one-time listeners, and callback execution order will trip you up if you haven't coded it before. If this problem hits your live assessment and you blank on the event queue or listener tracking logic, StealthCoder solves it in seconds, invisible to the proctor.
Companies that ask "Event Emitter"
Event Emitter is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderEvent Emitter requires you to implement a class that registers listeners, emits events, and executes callbacks in the right order. The real trap is managing state correctly: you need a Map or object to store listeners by event name, handle multiple listeners per event, support removal without breaking iteration, and implement once-listeners without polluting your listener list. Many candidates write the happy path and miss that removing a listener mid-emission or adding listeners during a callback can corrupt your iteration. The obvious approach (array of listeners per event) works, but you'll hit bugs if you mutate while iterating. StealthCoder is your safety net when the edge cases pile up and time pressure kicks in during the live assessment.
You know the problem.
Make sure you actually pass it.
Event Emitter recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Event Emitter interview FAQ
Is Event Emitter still asked at major companies?+
Yes. Tinkoff, Box, and Yandex report it. It's a medium-difficulty problem with 74% acceptance, so it's a threshold question: too easy to ignore, hard enough to separate candidates who've built real systems from those who've only studied leetcode.
What's the main trick to Event Emitter?+
Clean state management. You need a data structure that maps event names to listener arrays, handles removal safely (use filter or splice carefully), and tracks once-listeners without creating callback wrapper hell. Most fails come from corrupting the listener array during iteration or forgetting to actually remove a listener.
How do I handle removing a listener while it's executing?+
Classic problem. If you mutate the listener array during iteration, you'll skip listeners or crash. Best approach: iterate over a copy or use indices carefully. Or mark listeners for removal and clean up after the emit loop. Alternatively, use a Set and rebuild on each emit, which is simpler but less optimal.
Do I need to implement once-listeners separately?+
No, but you need a strategy. Common solutions: wrap the callback in a function that calls itself once then removes, or track once-listeners in a separate Set and remove after execution. The trick is not duplicating your listener removal logic. Keep it DRY.
What languages do companies expect for Event Emitter?+
Usually JavaScript, TypeScript, or Python. Event Emitter is a JavaScript idiom by origin, so expect those languages. The problem tests your ability to implement the pattern cleanly, not to memorize a library's API. Write your own.
Want the actual problem statement? View "Event Emitter" on LeetCode →