NeetCode #970LC-2694MediumJavaScript
← Back to All Problems#970 · #2694 · Event Emitter(事件发射器)
📌 Problem Statement & Constraints
Implement an
EventEmitter class: subscribe(eventName, callback) registers a callback and returns an object with an unsubscribe() method; emit(eventName, args) synchronously invokes all callbacks for that event and returns an array of their results. Constraints: at most 10^4 calls.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!